Exporting a model/XSI: Difference between revisions
TomEdwards (talk | contribs) (→Freeze transforms and history: some people still need to do this) |
TomEdwards (talk | contribs) No edit summary |
||
Line 11: | Line 11: | ||
:'''To learn about UV mapping in general, see [[XSI Texturing]].''' | :'''To learn about UV mapping in general, see [[XSI Texturing]].''' | ||
[[Image:Xsi addimage.jpg|thumb|180px|The | [[Image:Xsi addimage.jpg|thumb|180px|The 'Textures' dialogue.]] | ||
In the third group of left-hand menu buttons you will find | In the third group of left-hand menu buttons you will find 'Textures'. Select your mesh(es) and click the button and choose the first sub-option, 'Image'. There are two parts of this dialogue we are interested in: 'Image -> New' and 'Texture Projection -> New'. | ||
The filename of the image you import into XSI defines the name of the [[Valve Texture Format|VTF]] file Source will try to apply to the model in-game ([[$cdmaterials|though not its location]]). To avoid confusion, try to keep the texture name the same as the model name. If you | The filename of the image you import into XSI defines the name of the [[Valve Texture Format|VTF]] file Source will try to apply to the model in-game ([[$cdmaterials|though not its location]]). To avoid confusion, try to keep the texture name the same as the model name. If you don't want to worry about textures yet you can stick with XSI's default, but your model will be covered in Source's purple "missing material" checkerboard when you try to use it. | ||
Next is the texture projection, or [[UV map]]. The XSI [[Studio Model Data|SMD]] exporter will decide what to export by looking at what has UV data | Next is the texture projection, or [[UV map]]. The XSI [[Studio Model Data|SMD]] exporter will decide what to export by looking at what has UV data rather than what is hidden and what is visible, even if the mesh is intended for [[collision mesh|collision]], so don't forget this step! | ||
{{tip|The second and third sections of the Texture toolbar contain shortcuts for applying UV maps.}} | {{tip|The second and third sections of the Texture toolbar contain shortcuts for applying UV maps.}} | ||
Line 23: | Line 23: | ||
== Disable automatic discontinuity == | == Disable automatic discontinuity == | ||
It | It isn't clear why this next step is required – it may be a bug in the SMD exporter. Nevertheless: | ||
#Open the | #Open the 'Explorer' view. Find it in the Views section of the upper toolbar, or press {{key|8}} | ||
#Expand any of your meshes | #Expand any of your meshes | ||
#Double-click on | #Double-click on 'Geometry Approximation' | ||
#Choose | #Choose 'no' when prompted to make a local copy of the data | ||
#Click on the | #Click on the 'Polygon Mesh' tab of the new dialogue | ||
#Un-check | #Un-check 'Discontinuity -> Automatic' | ||
You may see your | You may see your meshes' lighting change slightly when you un-check the box. | ||
{{warning|Neglecting to change this setting will result in any collision meshes being merged into a single shape!}} | {{warning|Neglecting to change this setting will result in any collision meshes being merged into a single shape!}} | ||
Line 38: | Line 38: | ||
==Freeze transforms and history== | ==Freeze transforms and history== | ||
If you have any non-enveloped meshes, which to say if the model isn't animating, you must freeze them before ''each'' export operation. Enveloped meshes should have been frozen before their envelope was applied! | |||
Freezing 'bakes' your geometry, turning it from a series of manipulations on primitives (i.e. the cubes or spheres you began with) to a literal representation of where each polygon is located. Much like disabling automatic discontinuity, the fact that this step is required seems to be no more than a limitation of the XSI SMD exporter; unfortunately it's destructive and can really bugger you up if you aren't careful. | |||
To freeze, first select all of your meshes. Then click the section header for | To freeze, first select all of your meshes. Then click the section header for 'Transform', on the right-hand menu, and choose 'Freeze All Transforms', which is directly beneath the first divider. Then choose 'Freeze History -> Modeling' from the right-hand menu. | ||
{{tip|Since you'll probably be freezing transforms quite a lot, you may want to place its button in a more accessible location. Right-click on some empty space under the 'Freeze History' heading and choose 'Customize toolbar'. You can then search the list for 'Freeze All Transforms' and drag it onto the menu.}} | |||
{{tip|Since | |||
== Merge meshes == | == Merge meshes == | ||
Line 54: | Line 50: | ||
If your model has or will have animations you must merge all of its geometry into the same mesh. This would happen on Export anyway, but the automated version of the process destroys most envelope data. | If your model has or will have animations you must merge all of its geometry into the same mesh. This would happen on Export anyway, but the automated version of the process destroys most envelope data. | ||
Select everything and choose 'Mesh -> Merge' from the left-hand menu. This has created a new 'polymsh' object that contains some, but not all, of the data from your existing meshes. To merge the last few pieces of information in, open Explorer with {{key|8}} and double-click on 'polymsh -> Polygon Mesh -> Merge Meshes'. Look in the lower half of the new dialogue for two buttons labelled 'Merge' and press them, then press the 'Delete' button in the top half to remove the old input meshes. | |||
{{todo|What if you need to envelope part of a previously-merged mesh? A vertex cluster | {{todo|What if you need to envelope part of a previously-merged mesh? A vertex cluster doesn't help...}} | ||
== Export SMDs == | == Export SMDs == | ||
Your model is now ready for export to SMD. The export dialogue can be found from the main menu, under | Your model is now ready for export to SMD. The export dialogue can be found from the main menu, under 'ValveSource -> Export SMD...'. | ||
{{tip|Uncheck | {{tip|Uncheck 'Remove all unused bones' if you are exporting an animated collision model. Otherwise you can usually leave the checkboxes alone.}} | ||
<!-- | <!-- | ||
// move /integrate the following info to the [[Model Creation Overview]] ... this is general workflow info, not app-specific. It needs to be covered fully, explaining the purpose of each type of SMD and the specification for each : eg ref.smd contains skeleton, a single UV mapped deformable mesh, etc whereas phys.smd must be made of convex meshes, etc, etc. Models for skyboxes, viewmodels, etc don't need a collisionmodel ... etc | // move /integrate the following info to the [[Model Creation Overview]] ... this is general workflow info, not app-specific. It needs to be covered fully, explaining the purpose of each type of SMD and the specification for each : eg ref.smd contains skeleton, a single UV mapped deformable mesh, etc whereas phys.smd must be made of convex meshes, etc, etc. Models for skyboxes, viewmodels, etc don't need a collisionmodel ... etc | ||
Line 67: | Line 63: | ||
There are four types of SMD to choose from: | There are four types of SMD to choose from: | ||
#[[Reference mesh]] (called | #[[Reference mesh]] (called 'Model' here) | ||
#[[Collision mesh]] | #[[Collision mesh]] | ||
#[[Skeletal animation]] | #[[Skeletal animation]] | ||
#[[Vertex animation]] (for facial expressions) | #[[Vertex animation]] (for facial expressions) | ||
Every model needs at least one reference mesh and even if it isn't actually animated at least one skeletal animation (traditionally called | Every model needs at least one reference mesh and even if it isn't actually animated at least one skeletal animation (traditionally called 'idle'). Generally, except for idle animations which can be created from the reference mesh, each SMD will be exported from its own XSI file. | ||
It's recommended that you follow a naming convention and use these suffixes on your SMDs: | It's recommended that you follow a naming convention and use these suffixes on your SMDs: | ||
Line 79: | Line 75: | ||
*<code>phys</code> for the collision mesh | *<code>phys</code> for the collision mesh | ||
*<code><animation name></code> for each skeletal animation | *<code><animation name></code> for each skeletal animation | ||
* | *<code>expressions</code> for vertex animations | ||
So you might save | So you might save 'mymodel-ref.smd', for example. | ||
== Compile! == | == Compile! == |
Revision as of 14:53, 3 January 2009
This tutorial will show you how to export a model from the XSI Mod Tool for compiling with studiomdl.
To learn about the general usage of XSI, see the XSI Beginner Tutorial.
Add a texture and UV map
- To learn about UV mapping in general, see XSI Texturing.
In the third group of left-hand menu buttons you will find 'Textures'. Select your mesh(es) and click the button and choose the first sub-option, 'Image'. There are two parts of this dialogue we are interested in: 'Image -> New' and 'Texture Projection -> New'.
The filename of the image you import into XSI defines the name of the VTF file Source will try to apply to the model in-game (though not its location). To avoid confusion, try to keep the texture name the same as the model name. If you don't want to worry about textures yet you can stick with XSI's default, but your model will be covered in Source's purple "missing material" checkerboard when you try to use it.
Next is the texture projection, or UV map. The XSI SMD exporter will decide what to export by looking at what has UV data rather than what is hidden and what is visible, even if the mesh is intended for collision, so don't forget this step!

Disable automatic discontinuity
It isn't clear why this next step is required – it may be a bug in the SMD exporter. Nevertheless:
- Open the 'Explorer' view. Find it in the Views section of the upper toolbar, or press 8
- Expand any of your meshes
- Double-click on 'Geometry Approximation'
- Choose 'no' when prompted to make a local copy of the data
- Click on the 'Polygon Mesh' tab of the new dialogue
- Un-check 'Discontinuity -> Automatic'
You may see your meshes' lighting change slightly when you un-check the box.

Freeze transforms and history
If you have any non-enveloped meshes, which to say if the model isn't animating, you must freeze them before each export operation. Enveloped meshes should have been frozen before their envelope was applied!
Freezing 'bakes' your geometry, turning it from a series of manipulations on primitives (i.e. the cubes or spheres you began with) to a literal representation of where each polygon is located. Much like disabling automatic discontinuity, the fact that this step is required seems to be no more than a limitation of the XSI SMD exporter; unfortunately it's destructive and can really bugger you up if you aren't careful.
To freeze, first select all of your meshes. Then click the section header for 'Transform', on the right-hand menu, and choose 'Freeze All Transforms', which is directly beneath the first divider. Then choose 'Freeze History -> Modeling' from the right-hand menu.

Merge meshes
If your model has or will have animations you must merge all of its geometry into the same mesh. This would happen on Export anyway, but the automated version of the process destroys most envelope data.
Select everything and choose 'Mesh -> Merge' from the left-hand menu. This has created a new 'polymsh' object that contains some, but not all, of the data from your existing meshes. To merge the last few pieces of information in, open Explorer with 8 and double-click on 'polymsh -> Polygon Mesh -> Merge Meshes'. Look in the lower half of the new dialogue for two buttons labelled 'Merge' and press them, then press the 'Delete' button in the top half to remove the old input meshes.
Export SMDs
Your model is now ready for export to SMD. The export dialogue can be found from the main menu, under 'ValveSource -> Export SMD...'.

There are four types of SMD to choose from:
- Reference mesh (called 'Model' here)
- Collision mesh
- Skeletal animation
- Vertex animation (for facial expressions)
Every model needs at least one reference mesh and even if it isn't actually animated at least one skeletal animation (traditionally called 'idle'). Generally, except for idle animations which can be created from the reference mesh, each SMD will be exported from its own XSI file.
It's recommended that you follow a naming convention and use these suffixes on your SMDs:
ref
for the reference meshphys
for the collision mesh<animation name>
for each skeletal animationexpressions
for vertex animations
So you might save 'mymodel-ref.smd', for example.
Compile!
With a reference mesh SMD and skeletal animation SMD exported, you are ready to compile your model.