Ricochet
09-20-2005, 03:22 PM
I had some free time on my hands, so I wrote a tutorial on making static props with Softimage XSI. It took me a while to get all this figured out so I hope this will give mappers a kick-start on prop modelling.
I wasn't sure whether I should put this in MSA or Mapping , but I figured mapmodels/props usually belong in here.
If a mod wants to move this thread though, then by all means go ahead.
-------------------------------------------
Making a static prop model with Softimage XSI for Half-Life 2
Introduction
It has often been stated that mapping for the Source Engine has become much more complex, due to the addition of normal maps, specular maps, displacement surfaces, area_portals and so on. Furthermore, the basic mapping concept has moved towards using less world brushes and more props and models to construct the map geometry. Models are easier on the engine to render and offer certain advantages, for example the ability to define LODs (Levels of Detail) which allows the mapper to decrease a model's complexity depending on the distance between prop and player.
Therefore, mapping for Source requires map makers to be able to make props for their maps. These can either be static props, like fences and trees, or physics props like furniture, debris etc.
The 3D-modelling software Softimage XSI Mod Tool is available for free to HL2 users and can be downloaded off Softimage's website. This is a very complex and powerful software package which can do a lot more than just construct props. But since it is free, one may consider it a definite alternative to 3D Studio Max.
Motivation
Although XSI is a large software bundle, tutorials and documentation for making Half-Life 2 props are few and short. Most tutorials only deal with specific aspects of modelling or texturing. This turned out to be a big problem when I started fooling around with XSI. The whole work flow of constructing a model, skinning it and getting it in to your map had to be scrounged together off the internet. This is why I decided to write a comprehensive tutorial which outlines the whole process from start to finish.
Please note that I am not a modelling guru. I have just started to use XSI and may not know all it's little secrets. Still, if you simply want to build your own props and get them into your map, then after reading this tutorial, you should be able to do so.
I will not be going into every little detail of the XSI interface and modelling itself, because that's a chapter of its own. Please refer to other tutorials or XSI's documentation for that.
Getting Started
Start up XSI. First we're going to change some of the preferences to make XSI a bit easier to use. Click on the "Select" tab in the toolbar on the right and:
Deactivate "Select single object in region"
Deactivate "Expand component selection"
Here are also some useful shortcut keys. Learn to use them. It makes working with XSI so much easier these can be used in "supra" or "sticky" mode. This means that if you tap the key once, XSI switches to that tool, whereas when you keep the key pressed, the tool will only be active until you release the key again. This saves you a lot of switching between tools.
u - Select Polygon raycast mode
i - Select Edge raycast mode
t - Select Point mode
SPACE - Select object
m - Move Point tool
x - Scale Tool
c - Rotate Tool
v - Translate tool
Alt-7 - Texture editor
I am going to create this prop for HL2 Deathmatch. Depending on the mod for which you're making the prop you'll have to substitute the hl2mp in the directories which I am using.
Building your model
In order to keep this tutorial clear and to-the-point, we'll be modelling a simple fence post. This will basically be a skinned cylinder.
Start off by Selecting Get > Primitive > Polygon Mesh > Cylinder from the left toolbar. Set the height to 1 and radius to 0.1. Set the subdivisions to U = 8, V = 1 and Base = 1 and then close the window.
Go to the right toolbar. Click on the "t" for "translate" in the "Transform" tab and make sure that "Global" is selected. Then enter "0.5" in the Translate Y field and hit enter. The cylinder should now be standing vertically on the reference plane in the 3D View.
Make sure your cylinder object is selected and hit "Freeze" to freeze the transformations
Don't worry about units and sizes at this point. Try to work at a scale that comes natural to you, like 1 unit equals 1 meter or foot. We are going to scale the model to HL2 units afterwards when we compile it.
http://img202.imageshack.us/img202/6210/screen10hz.jpg
Texturing
Now we will apply a texture to the model. This is done by a process called UV Mapping. Our model is made up of lots of polygons, which are defined by their corner points or vertices. To get a 2D texture on a 3D model we have to tell XSI what part of the texture corresponds to what polygon by mapping the vertices on the texture. Each vertex gets a UV coordinate assigned to it, which basically is a relative position on the texture image.
I suggest using a generic checkerboard or grid texture first, so you can see if the texture is properly mapped and that there are no distortions. I'll skip this though.
Now, there are a couple of ways to texture your model. Either you draw the texture first and then do the UV-Mapping, or you can unwrap the model first und draw the texture to fit the UVs. I'll do it the first way. I've made a simple texture in Photoshop consisting of a basic wood texture for the sides and ends of the fencepost. Save this texture as fencepost.tga in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/materialsrc/models/Ricochet/.
http://img202.imageshack.us/img202/633/fencepost4wy.jpg
Now for applying the texture:
Click on the "Model" button in the upper left corner and switch the toolbar layout to "Render"
Select your object in the 3D or 2D views
In the left toolbar, do Get > Material > Blinn. A property window will pop up which you can close.
In the left toolbar, do Get > Texture > Image. A property window with XSI's standard texture will appear. Next to the first drop down menu, where it says "noIcon.pic", click on New > New from file... and select the fencepost.tga texture. Then, look down towards the Texture Projection tab and select New > UV. Close the window.
If you hit Alt-7 now you will open the texture editor and see your texture and the current UV map. At the moment it doesn't look very nice. In order to clean this up, go back to the 3D view and select all the polygons which make up the sides of the post with the raycast polygon select tool (Hotkey "u").
Now if you go back to the texture Editor you will see that these vertices are now selected.
http://img202.imageshack.us/img202/9171/screen27ke.jpg
In order for us to have a better view, go into the menu bar in the Texture Editor and select View > Show Selected. All unselected polygons are now hidden. We are going to unwrap these polygons cylindrically because this best emulates their shape in space. (You may notice that these polygons are already unwrapped cylindrically, but we'll do it anyway for practice). In the texture editor tool bar, click on the orange cylinder and then select XY object aligned. Now we have all the side polygons next to each other. Use the scale and translate tools to fit them onto the corresponding part of the texture.
After you've got the polygons where you want them, select View > Show All from the menu.
Now (in the 3D view) select the polygons which make up the bottom and top part of the cylinder and switch back to the Texture Editor. This time use the planar projection button (the orange plane) and then select "XZ World Aligned". This will map these polygons into an even octagon.
Move these polygons to where you want them to be and then have a look at the result in the 3d View. If you're happy with the result then move on to exporting. Freeze the model first, though, and save it.
You can export your UV map as a bitmap in the Texture Editor by clicking Edit > Stamp UV Mesh in the menu, in case you want to unwrap your model first and then fill in the textures.
http://img202.imageshack.us/img202/2246/screen36hd.jpg
Setting up for compiling
To compile this model, we need three .SMD files. One for the model, one for the animations (even though it has none) and one for the physics box (clipping/hitboxes). These SMD files need to be put together in the same directory. For this example, use .../SteamApps/your@username.com/sourcesdk_content/hl2mp/modelsrc/Ricochet/. Select your model, then in the menu bar select ValveSource > Export SMD...
In the dialog box, set the filename for the model SMD to fencepost.smd and click OK. Open the Export SMD... dialog again and this time select Physbox from the dropdown box and export this as fencepost_phys.smd by clicking OK. Lastly, select Skeletal Animation from the dropdown box and export this as fencepost_idle.smd.
Next, I suggest making shortcuts to studiomdl.exe and vtex.exe on your desktop. These files are located in .../SteamApps/your@username.com/sourcesdk/bin. This allows you to compile models and textures by dragging them onto the shortcut icon.
To begin compiling, make sure your fencepost.tga texture is located in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/materialsrc/models/Ricochet/. Likewise, your SMD models should be in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/modelsrc/Ricochet/.
Now, go to where your SMDs are and create a text file in the same directory called "fencepost.qc" copy the following lines into this file and save it:
// Output .MDL
$modelname Ricochet/fencepost.mdl
// Directory of materials that the model uses
$cdmaterials models/Ricochet
// Model properties
// model is a static prop
$staticprop
// Material properties
$surfaceprop "wood"
// Scale all units by a factor of 40
$scale 40.0
// Base or Reference .SMD
$body studio "./fencepost"
// sequences: all sequences are in $cd
$sequence idle "fencepost_idle" loop fps 15
// Physics data
$collisionmodel "fencepost_phys.smd" {
$Mass 5
$concave}
Compiling and finishing
Now drag the .qc file onto your studiomdl shortcut and watch it compile (provided Steam is running). The output will be placed in .../SteamApps/your@username.com/half-life 2 deathmatch/hl2mp/models/Ricochet/
Next, we have to compile the textures. Drag fencepost.tga onto your vtex shortcut. The texture will compile and create fencepost.vtf in .../SteamApps/your@username.com/hl2mp/materials/models/Ricochet/. Go to this directory and create text file named fencepost.vmt and copy the following lines in it:
"VertexLitGeneric"
{
"$baseTexture" "models/Ricochet/fencepost"
"$surfaceprop" "Wood_Solid"
}
And that's it! Now load up Hammer and add a prop_static model to the map. Open the entity properties, click Browse... and select ./Ricochet/fencepost.
http://img202.imageshack.us/img202/4669/screen43om.jpg
Further Reading
If you want to look into other aspects of modelling, compiling, texturing etc. I recommend the following sites:
Softimage website (http://www.softimage.com) - Where you can download Softimage XSI, documentation and read tutorials.
Valve Developer Wiki (http://developer.valvesoftware.com/wiki/Main_Page) - Official Valve Wiki with many tutorials.
HL2World.com Wiki (http://www.hl2world.com/wiki/index.php/Main_Page) - A community based Wiki with a large number of tutorials, even though many are the same as on the Valve Wiki.
Interlopers.net (http://www.interlopers.net/index.php?page=tutorials.htm) - Many tutorials, though mainly mapping
Desty's XSI Colt 1911 Video Tutorial (http://www.hl2modcentral.com/tutorial.php?id=27&cat=0) - A really great set of video tutorials for XSI. About 4 hours long all in all. Great for learning to model. At the time of this post, the page was offline. I'm posting this link anyway, hoping that the site will go up again soon.
Good luck,
Ricochet
I wasn't sure whether I should put this in MSA or Mapping , but I figured mapmodels/props usually belong in here.
If a mod wants to move this thread though, then by all means go ahead.
-------------------------------------------
Making a static prop model with Softimage XSI for Half-Life 2
Introduction
It has often been stated that mapping for the Source Engine has become much more complex, due to the addition of normal maps, specular maps, displacement surfaces, area_portals and so on. Furthermore, the basic mapping concept has moved towards using less world brushes and more props and models to construct the map geometry. Models are easier on the engine to render and offer certain advantages, for example the ability to define LODs (Levels of Detail) which allows the mapper to decrease a model's complexity depending on the distance between prop and player.
Therefore, mapping for Source requires map makers to be able to make props for their maps. These can either be static props, like fences and trees, or physics props like furniture, debris etc.
The 3D-modelling software Softimage XSI Mod Tool is available for free to HL2 users and can be downloaded off Softimage's website. This is a very complex and powerful software package which can do a lot more than just construct props. But since it is free, one may consider it a definite alternative to 3D Studio Max.
Motivation
Although XSI is a large software bundle, tutorials and documentation for making Half-Life 2 props are few and short. Most tutorials only deal with specific aspects of modelling or texturing. This turned out to be a big problem when I started fooling around with XSI. The whole work flow of constructing a model, skinning it and getting it in to your map had to be scrounged together off the internet. This is why I decided to write a comprehensive tutorial which outlines the whole process from start to finish.
Please note that I am not a modelling guru. I have just started to use XSI and may not know all it's little secrets. Still, if you simply want to build your own props and get them into your map, then after reading this tutorial, you should be able to do so.
I will not be going into every little detail of the XSI interface and modelling itself, because that's a chapter of its own. Please refer to other tutorials or XSI's documentation for that.
Getting Started
Start up XSI. First we're going to change some of the preferences to make XSI a bit easier to use. Click on the "Select" tab in the toolbar on the right and:
Deactivate "Select single object in region"
Deactivate "Expand component selection"
Here are also some useful shortcut keys. Learn to use them. It makes working with XSI so much easier these can be used in "supra" or "sticky" mode. This means that if you tap the key once, XSI switches to that tool, whereas when you keep the key pressed, the tool will only be active until you release the key again. This saves you a lot of switching between tools.
u - Select Polygon raycast mode
i - Select Edge raycast mode
t - Select Point mode
SPACE - Select object
m - Move Point tool
x - Scale Tool
c - Rotate Tool
v - Translate tool
Alt-7 - Texture editor
I am going to create this prop for HL2 Deathmatch. Depending on the mod for which you're making the prop you'll have to substitute the hl2mp in the directories which I am using.
Building your model
In order to keep this tutorial clear and to-the-point, we'll be modelling a simple fence post. This will basically be a skinned cylinder.
Start off by Selecting Get > Primitive > Polygon Mesh > Cylinder from the left toolbar. Set the height to 1 and radius to 0.1. Set the subdivisions to U = 8, V = 1 and Base = 1 and then close the window.
Go to the right toolbar. Click on the "t" for "translate" in the "Transform" tab and make sure that "Global" is selected. Then enter "0.5" in the Translate Y field and hit enter. The cylinder should now be standing vertically on the reference plane in the 3D View.
Make sure your cylinder object is selected and hit "Freeze" to freeze the transformations
Don't worry about units and sizes at this point. Try to work at a scale that comes natural to you, like 1 unit equals 1 meter or foot. We are going to scale the model to HL2 units afterwards when we compile it.
http://img202.imageshack.us/img202/6210/screen10hz.jpg
Texturing
Now we will apply a texture to the model. This is done by a process called UV Mapping. Our model is made up of lots of polygons, which are defined by their corner points or vertices. To get a 2D texture on a 3D model we have to tell XSI what part of the texture corresponds to what polygon by mapping the vertices on the texture. Each vertex gets a UV coordinate assigned to it, which basically is a relative position on the texture image.
I suggest using a generic checkerboard or grid texture first, so you can see if the texture is properly mapped and that there are no distortions. I'll skip this though.
Now, there are a couple of ways to texture your model. Either you draw the texture first and then do the UV-Mapping, or you can unwrap the model first und draw the texture to fit the UVs. I'll do it the first way. I've made a simple texture in Photoshop consisting of a basic wood texture for the sides and ends of the fencepost. Save this texture as fencepost.tga in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/materialsrc/models/Ricochet/.
http://img202.imageshack.us/img202/633/fencepost4wy.jpg
Now for applying the texture:
Click on the "Model" button in the upper left corner and switch the toolbar layout to "Render"
Select your object in the 3D or 2D views
In the left toolbar, do Get > Material > Blinn. A property window will pop up which you can close.
In the left toolbar, do Get > Texture > Image. A property window with XSI's standard texture will appear. Next to the first drop down menu, where it says "noIcon.pic", click on New > New from file... and select the fencepost.tga texture. Then, look down towards the Texture Projection tab and select New > UV. Close the window.
If you hit Alt-7 now you will open the texture editor and see your texture and the current UV map. At the moment it doesn't look very nice. In order to clean this up, go back to the 3D view and select all the polygons which make up the sides of the post with the raycast polygon select tool (Hotkey "u").
Now if you go back to the texture Editor you will see that these vertices are now selected.
http://img202.imageshack.us/img202/9171/screen27ke.jpg
In order for us to have a better view, go into the menu bar in the Texture Editor and select View > Show Selected. All unselected polygons are now hidden. We are going to unwrap these polygons cylindrically because this best emulates their shape in space. (You may notice that these polygons are already unwrapped cylindrically, but we'll do it anyway for practice). In the texture editor tool bar, click on the orange cylinder and then select XY object aligned. Now we have all the side polygons next to each other. Use the scale and translate tools to fit them onto the corresponding part of the texture.
After you've got the polygons where you want them, select View > Show All from the menu.
Now (in the 3D view) select the polygons which make up the bottom and top part of the cylinder and switch back to the Texture Editor. This time use the planar projection button (the orange plane) and then select "XZ World Aligned". This will map these polygons into an even octagon.
Move these polygons to where you want them to be and then have a look at the result in the 3d View. If you're happy with the result then move on to exporting. Freeze the model first, though, and save it.
You can export your UV map as a bitmap in the Texture Editor by clicking Edit > Stamp UV Mesh in the menu, in case you want to unwrap your model first and then fill in the textures.
http://img202.imageshack.us/img202/2246/screen36hd.jpg
Setting up for compiling
To compile this model, we need three .SMD files. One for the model, one for the animations (even though it has none) and one for the physics box (clipping/hitboxes). These SMD files need to be put together in the same directory. For this example, use .../SteamApps/your@username.com/sourcesdk_content/hl2mp/modelsrc/Ricochet/. Select your model, then in the menu bar select ValveSource > Export SMD...
In the dialog box, set the filename for the model SMD to fencepost.smd and click OK. Open the Export SMD... dialog again and this time select Physbox from the dropdown box and export this as fencepost_phys.smd by clicking OK. Lastly, select Skeletal Animation from the dropdown box and export this as fencepost_idle.smd.
Next, I suggest making shortcuts to studiomdl.exe and vtex.exe on your desktop. These files are located in .../SteamApps/your@username.com/sourcesdk/bin. This allows you to compile models and textures by dragging them onto the shortcut icon.
To begin compiling, make sure your fencepost.tga texture is located in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/materialsrc/models/Ricochet/. Likewise, your SMD models should be in .../SteamApps/your@username.com/sourcesdk_content/hl2mp/modelsrc/Ricochet/.
Now, go to where your SMDs are and create a text file in the same directory called "fencepost.qc" copy the following lines into this file and save it:
// Output .MDL
$modelname Ricochet/fencepost.mdl
// Directory of materials that the model uses
$cdmaterials models/Ricochet
// Model properties
// model is a static prop
$staticprop
// Material properties
$surfaceprop "wood"
// Scale all units by a factor of 40
$scale 40.0
// Base or Reference .SMD
$body studio "./fencepost"
// sequences: all sequences are in $cd
$sequence idle "fencepost_idle" loop fps 15
// Physics data
$collisionmodel "fencepost_phys.smd" {
$Mass 5
$concave}
Compiling and finishing
Now drag the .qc file onto your studiomdl shortcut and watch it compile (provided Steam is running). The output will be placed in .../SteamApps/your@username.com/half-life 2 deathmatch/hl2mp/models/Ricochet/
Next, we have to compile the textures. Drag fencepost.tga onto your vtex shortcut. The texture will compile and create fencepost.vtf in .../SteamApps/your@username.com/hl2mp/materials/models/Ricochet/. Go to this directory and create text file named fencepost.vmt and copy the following lines in it:
"VertexLitGeneric"
{
"$baseTexture" "models/Ricochet/fencepost"
"$surfaceprop" "Wood_Solid"
}
And that's it! Now load up Hammer and add a prop_static model to the map. Open the entity properties, click Browse... and select ./Ricochet/fencepost.
http://img202.imageshack.us/img202/4669/screen43om.jpg
Further Reading
If you want to look into other aspects of modelling, compiling, texturing etc. I recommend the following sites:
Softimage website (http://www.softimage.com) - Where you can download Softimage XSI, documentation and read tutorials.
Valve Developer Wiki (http://developer.valvesoftware.com/wiki/Main_Page) - Official Valve Wiki with many tutorials.
HL2World.com Wiki (http://www.hl2world.com/wiki/index.php/Main_Page) - A community based Wiki with a large number of tutorials, even though many are the same as on the Valve Wiki.
Interlopers.net (http://www.interlopers.net/index.php?page=tutorials.htm) - Many tutorials, though mainly mapping
Desty's XSI Colt 1911 Video Tutorial (http://www.hl2modcentral.com/tutorial.php?id=27&cat=0) - A really great set of video tutorials for XSI. About 4 hours long all in all. Great for learning to model. At the time of this post, the page was offline. I'm posting this link anyway, hoping that the site will go up again soon.
Good luck,
Ricochet