adding custom meshes to hammer
Download
Skip this Video
Download Presentation
Adding custom meshes to Hammer

Loading in 2 Seconds...

play fullscreen
1 / 14

Adding custom meshes to Hammer - PowerPoint PPT Presentation


  • 256 Views
  • Uploaded on

Adding custom meshes to Hammer Covering prop\_static prop\_dynamic & prop\_physics

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Adding custom meshes to Hammer' - lotus


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
adding custom meshes to hammer

Adding custom meshes to Hammer

Covering prop_static

prop_dynamic &

prop_physics

slide2
Models in Hammer use the .mdl extension, and there is no way to export straight from a modelling package (3DSMax) to this format, we must export a number of files in the .smd format which contain animation, mesh and collision data, and use a script file (.qc) to compile all the data into the final .mdl which hammer can use.

First off, you will need a tool to export from 3DSMax to the .smd format, the best is a 3rd party plugin found at http://www.chaosincarnate.net/cannonfodder/cftools.htm (google cannonfodder tools). Download, extract (winrar) and copy both files to your /3dsmax8/plugins directory.

slide3
Now we can download the example meshes for this tutorial, find them at http://www.hidden-source.com/downloads/gamesdesign_ws.zip

Extract, and open prop_static_ws.max.

When 3DSMax loads, you will have a scene containing a simple mesh with a material assigned to it. We are going to export this mesh for use as a static mesh (prop_static) in hammer, so go to file-export and find a suitable directory (commonly the modelsrc folder of your mod.

This is where we export the .smd files, so locate the format on the filetypes dropdown. We need two .smd files to export all the information in this scene; a reference file which contains mesh and texture information, and a skeletal animation file which contains bone movement information.

Export a file named ‘reference.smd’ and choose the ‘reference’ type in the exporter window. Go to file-export again and export ‘idle.smd’ choosing the ‘skeletal animation’ option this time.

slide4
Now we compile the .smd files using the .qc, before we continue, make sure the ‘hide extensions for known filetypes’ option in Windows is off. Create a new text document and rename it to xxxx.qc. Double click on it and it will ask you to specify a program to run, browse to your steam/steamapps/(name of active account)/sourcesdk/bin folder and choose ‘studiomdl.exe’, this is the program which compiles the .smd information into the final .mdl.

Now open the .qc with notepad and use the example .qc on the next page to set up the script.

slide5
//prop_static_ws.qc

//your directory which contains the .smd files you exported from 3DSMax

$cd "C:\unimod\modelsrc\prop_static_ws"

//directory within steamapps/yourmod/models and name of final model

$modelname "prop_static_ws.mdl"

//needed to show hammer the model is to be treated as a prop_static

$staticprop

//your reference .smd

$body studio "reference.smd"

//uniform scale modifier – change value to modify the size of the object in hammer without re-exporting from 3DSMax

$scale 3.0

//directory containing the materials for the mesh

$cdmaterials "models"

//skeletal animation .smd (not used in in static meshes, but required anyway)

$sequence idle "idle.smd" loop fps 15

//collision information – the physical presence the object has in the game world. Using the same reference file from before will auto-generate an optimised collision box, if you wish this to be a custom shape, you use another .smd which has been exported as a reference

$collisionmodel “reference.smd"

{

$Mass 100

$concave

}

slide6
Save and close notepad, and double-click on the .qc file. Because we associated it with studiomdl.exe earlier, it will now compile the model.

You will now find a collection of files in the output directory you specified in the .qc the most important is the .mdl. Double click on it and you will be asked which program to associate it with, browse to the same ‘bin’ directory as before, and choose hlmv.exe, the half-life model viewer. The model will now open in the viewer, and should look something like this:

The pink/black checkerboard shows us the texture cannot be found, so copy the .vmt and the .vtf that came with the mesh into the materials folder you specified in the .qc. Load up the model viewer again and the material will be applied to the mesh. On the next page we will look at the .vmt for a model’s material.

slide7
//gen_democharge.vmt

//notice that model materials use the ‘VertexLitGeneric’ shader, as opposed to the ‘LightmappedGeneric’ shader which bsp (world) materials use.

"VertexLitGeneric"

{

"$baseTexture" "models/gen_democharge“

//the $model tag shows the engine that the material is for a mesh

"$model" 1

//controls the type of surface the model will have, check the accompanying propdata.txt for a complete list.

"$surfaceprop" "metal“

"$envmap" "env_cubemap“

"$envtint" "[.0.25 .025 .025]“

//"$bumpmap" "models\generic\gen_democharge_normal“

//"$normalmapalphaenvmapmask" 1

}

slide8
Now you can use the prop_static entitity within hammer to load your mesh into a level.

Next, we will look at prop_dynamic and prop_static entities.

slide9
Dynamic and physics meshes use many of the same steps which the static mesh tutorial covers, as such I will skip over the common steps, check back if you forget how to do something.

Dynamic meshes are animated props which commonly repeat an indefinitely looping animation within the game. If you load the prop_dynamic_ws.max example you can see a simple object with a 30 frame looping animation set up already. When you load it, 3DSMax will ask you to locate a missing texture, don’t worry about this, it is a placeholder material without which studiomdl.exe is incapable of compiling a model.

Export the skeletal animation and reference .smd files as before and create a new .qc file. The .qc for a dynamic mesh looks a little different, the main changes are highlighted on the next page.

slide10
//prop_dynamic_ws.qc

$cd "C:\unimod\modelsrc\prop_dynamic_ws"

$modelname "prop_dynamic_ws.mdl"

//importantly there is no $staticprop tag

$body studio "reference.smd"

$cdmaterials "models"

//the skeletal animation .smd now contains useful information, ensure the ‘loop’ switch is present if you want a looping animation and that the playback fps value is the same as in 3DSMax

$sequence idle "idle.smd" loop fps 30

$collisionmodel "reference.smd"

{

$Mass 100

$concave

}

slide11
Compile the mesh and load hammer, create a prop_dynamic entity, specify our mesh as the world model and enter the name of our looping animation into the * box (in this case, ‘idle’.

The animation will now play indefinitely in your level.

slide12
Prop_physics

Load the example .max and export the skeletal and reference .smd files.

Bring up the .qc and we’ll see what is different:

slide13
//prop_physics_ws.qc

$cd "C:\unimod\modelsrc\prop_physics_ws"

$modelname "prop_physics_ws.mdl"

//no $staticprop

$body studio "reference.smd"

$cdmaterials "models"

$surfaceprop "metal"

$sequence idle "idle.smd" loop fps 15

//defines the mass of the object – how heavy it is in game

$collisionmodel "reference.smd"

{

$Mass 5

}

//Defines the physical properties of the objects, the “metal.Small” is a template, check the propdata.txt file for a complete list. You can also write your own custom template, use the valve wiki to find all the commands and their appropriate values.

$keyvalues

{

"prop_data"

{

"base" "metal.Small"

}

}

ad