Making models for Empires Source MP 2013

Discussion in 'Art' started by f1r3w4rr10r, Mar 29, 2014.

  1. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    ###Short Version###

    -build your reference model
    -build your physbox and LODs, if needed

    -create a diffuse map
    -bake a normal map, if you can
    -create a specular and a glossiness map, if possible

    -put the specular in the alpha channel of the normal map
    -put inverted glossiness map in phongexponenttexture

    -export your SMDs from your modeling application

    -create your QC similar to this:
    Code:
    $modelname                  <output_model_path> // relative to Empires\empires\models\
    
    $staticprop
    
    $cdmaterials                <material_folder> // relative to Empires\empires\materials\
    $surfaceprop                Plastic_Box
    
    // all mesh paths relative to QC file
    $body           crate       <reference_mesh>
    $sequence       idle        <reference_mesh>
    
    $collisionmodel             <physbox>
    {
        $automass
    }
    
    $lod 20
    {
        replacemodel <reference_mesh> <reference_mesh_lod1>
    }
    
    $lod 40
    {
        replacemodel <reference_mesh> <reference_mesh_lod2>
    }
    
    $shadowlod
    {
        replacemodel <reference_mesh> <reference_mesh_lod1>
    }
    -have a shortcut to
    Steam\steamapps\common\Empires\bin\studiomdl.exe
    with -game Steam\steamapps\common\Empires\empires\ appended on the execution command
    -drag your QC on the shortcut

    - for easier error reading run
    Code:
    Steam\steamapps\common\Empires\bin\studiomdl.exe -game Steam\steamapps\common\Empires\empires\ <your_qc_file_path>
    -your compiled model is now in Empires\empires\models\<output_model_path>

    you will need this for the next step:
    [​IMG]


    Process.bat (made by Smithy, modified by me)
    Code:
    cd C:\Users\Kai\Documents\models\!Source_Tools\VTFCMD
    PUSHD %~dp0
    :s_next
    echo %1
    IF [%1] EQU [] GOTO :eof
    set var=%~n1
    IF NOT x%var:normal=%==x%var% (
    vtfcmd.exe -file %1 -output "output" -format "DXT5" -alphaformat "DXT5" -mfilter "Catrom" -msharpen "Unsharp" -flag "NORMAL"
    ) ELSE (
    vtfcmd.exe -file %1 -output "output" -format "DXT5" -alphaformat "DXT5" -mfilter "Catrom" -msharpen "Unsharp"
    )
    SHIFT
    GOTO :s_next
    :s_end
    POPD
    -drag your textures onto the Process.bat
    -they will appear in the Output folder

    -write your VMT like this:
    Code:
    VertexLitGeneric {
    // all map paths relative to Empires\empires\materials\
        $basetexture             <diffuse_map_path>
        $model 1
        $phong 1
        $bumpmap                 <normal_map_path>
    //  $phongexponent           5                     // either/or
        $phongexponenttexture    <phongexponenttexture_map_path> // either/or
        $phongboost              1.0
        $phongfresnelranges	     "[0 0.5 1]"
    }
    
    -put your VMT in <material_folder> specified in your QC and your VTFs in the paths specified in your VMT

    DONE!

    for viewing, make a shortcut similar to studiomdl shortcut, but replace the actual shortcut target with HLMV in the same folder
    the -game parameter stays the same
    drag your compiled MDL on the shortcut and your model should be opened in HMLV
     
  2. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    ###Long Version###

    Build your Highpoly and Lowpoly models

    Build your models with your preferred method. You can read up on my preferred modeling workflow here. You need to apply the materials you want to each polygon.


    Make your LODs

    Make as many LOD levels as you need. Only remove vertices and edges where least visible and make sure to fix the UV maps if necessary.


    Make your Physbox

    This will be a mesh that only roughly outlines the collision volume of your model. You can use as quite a lot of separate elements, but take care to only use convex elements. If you need to model a concave volume, use multiple convex elements. Those elements also need to be completely smooth.
    If you use more than just the default 20 elements, you need to add $maxconvexpieces <int> to your $collisionmodel, where <int> has to be the same or higher than your count of separate elements.


    Exporting

    Export every mesh and animation you made as a .smd. You will need a reference.smd (which is just your static model in it’s default position), an LOD.smd for each LOD you have, a physbox.smd for your collision model and a animation.smd for each animation you have.


    Compile your models

    First you will need your .qc file. Make a new text file and change the file extension to .qc. This file should contain the following:
    Code:
    $modelname                  <output_model_path> // relative to Empires\empires\models\
                                // this is the path where your model will end up in in the game folder
    
    $staticprop                 // only set this, if the model is a static prop (no animations, can’t be moved by physical forces)
    
    $cdmaterials                <material_folder> // relative to Empires\empires\materials\
                                //this is the path where the game will look for the model’s materials (your VMT files)
    $surfaceprop                Plastic_Box // use whatever surface property you want (full list: https://developer.valvesoftware.com/wiki/Material_surface_properties )
    
    // all mesh paths relative to QC file
    $body           crate       <reference_mesh>
    $sequence       idle        <reference_mesh>
    
    $collisionmodel             <physbox>
    {
        $automass
    }
    
    $lod 20
    {
        replacemodel <reference_mesh> <reference_mesh_lod1>
    }
    
    $lod 40
    {
        replacemodel <reference_mesh> <reference_mesh_lod2>
    }
    
    $shadowlod
    {
        replacemodel <reference_mesh> <reference_mesh_lod1>
    }
    For a full list of QC Commands, have a look here.

    Then, open a console in: Steam\steamapps\common\Empires\bin\
    Then execute:
    Code:
    studiomdl.exe -game Steam\steamapps\common\Empires\empires\ <your_qc_file_path>
    Make sure that you keep the space between the -game parameter path and the path to your QC file. Those two are separate arguments.
    Alternatively, you can just create a shortcut on your desktop or elsewhere to Steam\steamapps\common\Empires\bin\studiomdl.exe with -game Steam\steamapps\common\Empires\empires\ appended on the execution command. Then drag your QC file onto the shortcut.
    Afterwards your model will be in Empires\empires\models\<output_model_path>.


    Make your textures

    Create your diffuse, specular and glossiness maps. Both specular and glossiness maps have to be grayscale. Bake your normal map, then put your specular map in the alpha of your normal map. Finally, invert the glossiness map and put it in the red channel of your phongexponenttexture.


    Get your texture compiling set up

    You will need VTFCmd.exe for the next step. Make sure to download the binary version. Unzip the downloaded archive. You can find everything in bin folder and then the one corresponding to your OS version. (If you are not sure which you have, take x86)
    Next, put that in the folder you want to use for your texture compiling. Preferably drop a link to it on your desktop. Also create a folder in that working folder, called “Output”. Then create a new .bat file in that folder. (Just create a text file and replace the file extension) The .bat should contain the following:
    Code:
    cd C:\Users\Kai\Documents\models\!Source_Tools\VTFCMD
    PUSHD %~dp0
    :s_next
    echo %1
    IF [%1] EQU [] GOTO :eof
    set var=%~n1
    IF NOT x%var:normal=%==x%var% (
    vtfcmd.exe -file %1 -output "output" -format "DXT5" -alphaformat "DXT5" -mfilter "Catrom" -msharpen "Unsharp" -flag "NORMAL"
    ) ELSE (
    vtfcmd.exe -file %1 -output "output" -format "DXT5" -alphaformat "DXT5" -mfilter "Catrom" -msharpen "Unsharp"
    )
    SHIFT
    GOTO :s_next
    :s_end
    POPD

    Compile your textures

    Make sure that your normal map file name contains “normal”. Then drag your textures on the .bat file you created. After VTFCmd is done, you will find them in the Output folder.
    Next you will need to write your VMT files. You will need one for each material you used on your model. Your VMT should contain the following:
    Code:
    VertexLitGeneric {
    // all map paths relative to Empires\empires\materials\
        $basetexture             <diffuse_map_path>
        $model 1
        $phong 1
        $bumpmap                 <normal_map_path>
    //  $phongexponent           5                     // either/or
        $phongexponenttexture    <phongexponenttexture_map_path> // either/or
        $phongboost              1.0
        $phongfresnelranges	     "[0 0.5 1]"
    }
    For a more in-depth description of the phongexponenttexture, have a look here at $PhongExponentTexture

    Put your VMT in <material_folder> specified in your QC and your VTFs in the paths specified in your VMT.


    Viewing your model

    For viewing your model, make a shortcut similar to the studiomdl shortcut, but replace the actual shortcut target with hlmx.exe in the same folder, while the -game parameter stays the same.
    Then drag your compiled MDL on the shortcut and your model should be opened in HMLV.
     
  3. LordDz_2

    LordDz_2 Strange things happens here

    Messages:
    2,956
    Likes Received:
    93
    Trophy Points:
    0
    There's also Propper which I haven't got to work yet, but will when I have more time.

    It makes brushes into a prop.
     
  4. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    It will always keep looking like a brush though, ive used it to simplify func_detail geometry that would be hard to make a model for and then scale it correctly so it will fit 100% but that's about the use for it and nothing more.
     
  5. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    Funny that you post on this now. I am actually writing the long version right now. Which is probably going to be split up, since I am already drifting off in explaining my current workflow again and it's already a giant wall of text...
     
  6. f1r3w4rr10r

    f1r3w4rr10r Modeler

    Messages:
    2,475
    Likes Received:
    4
    Trophy Points:
    0
    Finally posted the long version and made some fixes to the short version. Notably a correction on the glossiness map process.
     

Share This Page