160 likes | 259 Views
Static Models, Maya, & Valve Modeling, Exporting, and Compiling. Feb 8 th 2006. Static Models. Scene geometry in the Valve system is usually modeled as brushes inside of Hammer
E N D
Static Models, Maya, & ValveModeling, Exporting, and Compiling Feb 8th 2006
Static Models • Scene geometry in the Valve system is usually modeled as brushes inside of Hammer • However, static geometry can also be designed in a separate modeling program, such as Maya or XSI and brought into your game • Valve used XSI to create all the models and animations in the game Half-Life 2 • Lets create & import a static Maya model • We will model in Maya, export to the .smd file format, then compile into a .mdl
Materials • In the Valve system, we do not work with .bmp or .jpg image files, but rather a proprietary Valve file format called .vtf • VMT = Valve Material • Defines a shader & its parameters • VTF = Valve Texture Format • Stores textures (a lot more on this later!) • You can download VTFEdit to take .bmp and .jpg image files to the proprietary .vmt and .vtf • Can also use vtex.exe utility (material compiler) • vtex.exe –mkdir –shader VertexLitGeneric image.bmp
SMD File Types • SMD file types at your disposal • model_reference.smd • Model geometry • model_phy.smd • Physics geometry • model_animation_name.smd • Bones, skinning id’s, skinning weights, blending matrices … • model_break.smd • For breakable models • model_lod.smd • For different level of details
Valve & Static Models • For a static model we will need to create a reference model and a physics model • First, compile the TGA image into a VMF & VTF • Your image size needs to be a power of 2, and most typical sizes are 512x512 and 1024x1024 • We will use a utility called studiomdl.exe to compile all of our SMD files into a single MDL file that the Valve engine can use • When we import these static Maya models we can treat them as entities and interact with them within the IO system
Maya Exporter • We need an exporter in order to take a Maya scene and generate the necessary SMD files • Use the following helpful link for static model exporting • http://student.fho-emden.de/~marteppe/monogreen/otherstuff/tut03.htm • Download a Maya SMD exporter from • http://mitglied.lycos.de/prallvamp/ • Extract files and copy under the Maya scripts directory • You need to replace the existing FileMenu script, so I also copied these files (I am lazy) into the startup folder under the scripts directory • When you go into Maya, you will now see a export to SMD menu tab under the File menu
Step 1: Project Settings • Set the Maya Project Settings • Go to File->Project->Set • Select your mod folder • For ‘Source Images’ • Type in ‘materialsrc’ • For ‘Scenes’ • Type in ‘scenes’ • Hit accept
Step 2: Maya Settings • Set the Maya world settings • Set the Z axis to up and use inches • Go to Window->Settings/Preferences->Preferences • Click on Settings • Change to Z axis up • Change working units to inches
Step 3: Layers • We need to make two layers to edit our geometry in: physics and reference • Click on Persp/Outliner • Go to Panels->Panel->Relationship Editor • Pull down ‘Display Layers’ • Click on Edit->Create Display Layer • Double click on the ‘layer1’ and type ‘reference’ and hit enter • Do the same and make a ‘physics’ layer
Step 4: Reference Model • Create the geometry (our static model) • Go to Create->Polygon Primitives->Cube • Click on polyCube1 and make the width, height, and depth be (70, 70, 70) • Select pCube, and change the ‘Transform Attributes’ to (0,0,35) • The (x,y) plane is the ground, so moving the player up 35 puts its base on the floor
Step 5: Texture • Set the texture on the static model • Go to Window->Rendering Editors->Hypershade • Click on Create->Materials->PhongE • Click on Create->2D Textures->File • Click on the 2D Texture File object • Open your TGA texture under materialsrc folder • Drag the 2D Texture File object onto the PhongE object (select ‘Default’) • Drag the PhongE model onto the cube you placed in the scene
Step 6: Physics Layer • Move the pCube1 and all of its objects to the reference layer • Make another cube (no NURBS, or do a conversion from NURBS to polygonal data later) for the physics geometry • Move the pCube2 physics object into the physics layer
Step 7: Additional Step • Click on the pCube2, i.e. the physics object, and hold down select • Click on Edit Polygons->Normals->Soften/Harden Options • Set the angle to 180 and hit apply
Step 8: Exporting • Finally, its time to export • Go to File->Export SMD Options • Under ‘Path Settings’ set (first hit default) • smd/qc path • …modelsrc/MyScene.smd • texture path • …materialsrc/ • Click on OK settings, and then Full Compile • This will generate SMD files and your QC file
Step 9: QC File • QC files are text files that hold the name of each SMD file and parameters for compiling to a MDL • Read more online about the .qc format • Example QC file for us • $modelname "TestScene.mdl" • $scale 1 • $surfaceprop "default" • $keyvalues { "prop_data" { "base" "Wooden.Large" } } • $body "Body" "TestScene" • $sequence idle "TestScene_idle" loop fps 1 • $collisionmodel "TestScene_phy.smd" • { • $mass 1 • $concave • }
Step 10: MDL Compilation • Now, go into the directory that has your .qc file and run the studiomdl.exe program • Example: • studiomdl.exe TestScene.qc • If your mod was selected as the current mod and you followed the directory instructions, you should now have a .mdl file under your ‘content directory’ in the models folder • When you build your textures, the Valve system should have copied the VMT and VTF files into the ‘content directory’ in the materials folder