|
Back to Tutorials Page
Basic Modeling: Creating, skinning, and
compiling a block
By Matrixfan Last changed Aug
15, 2006
This simple tutorial will guide you through creating a
block in 3D Studio Max, unwrapping the model, creating a
skin in Photoshop, and finally, getting the model
working in Counter-Strike Source.
Before you begin there are several plugins you will need:
MAX SMD Exporter
Photoshop VTF Plugin
Textporter
Step One: Creating the cube
Start 3DS, and create a box. Set the length, width, and
height to 10. Set the length, width, and height segments
to 1.
Right click the box and choose "Convert to>Editable
Mesh"
Go to the modify tab and add an "Unwrap UVW" modifier to the
editable mesh.
On the Unwrap UVW modifier, click edit and then select everything,
Click "Mapping>Unfold mapping...", leave the default
settings and click Ok.
What we have now is the UVW map that we will need to
paint with the texture.
We needed Texporter so that we can save this as a jpg that can be
opened in Photoshop.
Close the Edit UVW window and go to the 3DS Utilities tab. Click
"More..." and double click Texporter. Change the image width and
height to a size that is a power of 2. For this tutorial I will be
using 512x512. Click "Pick Object" and then click on the box in the
view port, a render window will pop up with the UVW map. Save this
file as a jpg to the location of your choice.
Step Two: Texturing the cube
Start Photoshop and load the file you just created. At
this point you can paint whatever you want onto the box.
I chose to make it an alphabet block.
Once you have finished making your texture, save the file as "blockskin.vtf"
in your "counter-strike source\cstrike\materials" folder.
Save another copy of your file as blockskin.jpg.
Step Three: Creating necessary files
Go back to 3DS and open the material editor by pressing
'M'. Select the first material slot and click the button
next to diffuse. Double click the bitmap option and load
blockskin.jpg that you created in the last step. Apply
the material to your block by dragging the textured
sphere onto it.
Now we need to create the two SMD files. Select "File>Export" and
put in block_ref for the file name, change the file type to "Valve
HL2 SMD" and save it in "sourcesdk\cstrike_sample_content\model_sources".
You will be presented with a popup menu, choose "Reference" and make
sure "Flip all normals" is unchecked. Now we need to create the
skeletal SMD. Follow the same steps as before except save it as
block_still and on the popup menu choose "Skeletal Animation".
The next file we need to make is the VMT. Start notepad and put this
in:
"VertexLitGeneric"
{
"$BaseTexture" "blockskin"
"$model" 1
}
Save the file as "blockskin.vmt" in "counter-strike source\cstrike\materials"
Now we need to create a QC file that will tell the compiler what
to do.
Start notepad again and put in:
// Output .MDL
$modelname "block"
// Directory of .SMD
$cdmaterials ""
// Write textures into a ???T.mdl
//$externaltextures
$scale 1.0
// whole body
$body studio "block_ref.smd"
// sequences: all sequences are in $cd
$sequence idle "block_still.smd" loop fps 15
$collisionmodel "block_ref.smd" {
// Mass in kilograms
$Mass 1
$concave
}
Save this as "block.qc"
in "sourcesdk\cstrike_sample_content\model_sources"
This is the last time you
need to open Notepad, I promise. Put in:
studiomdl.exe ..\cstrike_sample_content\model_sources\block.qc
pause
Save as "block.bat" in "sourcesdk\bin"
Step Four: Compiling the model
Start the Source SDK and
make sure your game is set to Counter-Strike:Source
Go to your sourcesdk\bin
directory and run the block.bat you created.
Once Studio Model has
finished running, start model viewer and if you did everything
correctly, the model will be there under the name "Block".
Back to Tutorials Page
|