User Tools

Site Tools


hpl3:engine:model_export

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hpl3:engine:model_export [2013/10/04 20:36]
aaron.clifford [Modelling]
hpl3:engine:model_export [2018/12/04 07:47] (current)
nebej
Line 1: Line 1:
 ====== Model Export ====== ====== Model Export ======
- 
  
 HPL3 mainly uses [[http://​www.khronos.org/​collada/​|Collada]] for importing models into the engine binary format, so this guide will only be about the Collada format (.dae). First of there will be some general information that concerns all 3d modelers. After that there will be some more specifics for the mayor packats HPL3 mainly uses [[http://​www.khronos.org/​collada/​|Collada]] for importing models into the engine binary format, so this guide will only be about the Collada format (.dae). First of there will be some general information that concerns all 3d modelers. After that there will be some more specifics for the mayor packats
- 
  
 ===== General ===== ===== General =====
- 
  
 ==== Setup ==== ==== Setup ====
  
- +**__Units__ ** \\
-**__Units__ ** \\ +
 Before doing any modelling, make sure that the units are properly set up. It is recommended that 1 unit equal 1 meter. It is also okay that 1 unit = 1 centimeter, but then a 1 meter high object needs to be 100 units high and so on. The engine will automatically adjust any data according to how the units are set up. Before doing any modelling, make sure that the units are properly set up. It is recommended that 1 unit equal 1 meter. It is also okay that 1 unit = 1 centimeter, but then a 1 meter high object needs to be 100 units high and so on. The engine will automatically adjust any data according to how the units are set up.
- 
  
 When working with animated objects the unit scale must be the same for the mesh and the animation. If they are different the animation will scaled incorrectly,​ causing the mesh to expand or shrink when animated. When working with animated objects the unit scale must be the same for the mesh and the animation. If they are different the animation will scaled incorrectly,​ causing the mesh to expand or shrink when animated.
- 
  
 ==== Modelling ==== ==== Modelling ====
  
 +**__Setting Material__ ** \\
 +Always set the diffuse texture of the editor-material to have the same name as the engine-material (.mat) you want it to have. This is best accomplished by always letting the diffuse texture for the material have the same name as the engine-material (e.g. "​dirt_road.dds"​ and "​dirt_road.mat"​). What happens when the model is loaded is that the engine checks the diffuse texture for the current submesh and then replaces the extention (eg "​.dds",​ "​.tga",​ etc) with "​.mat"​ and then tries to load a material with that file name.\\
 +**Note:** When using the modelviewer,​ it will automatically create the "​.mat"​-file if one does not exist, and thus an engine-material does not need to be created by hand if the names of the texture are set up as described [[:​hpl3:​engine:​here|here]].
  
-**__Setting Material__ ** \\  +**__Multiple Materials__ ** \\ 
-Always set the diffuse texture of the editor-material to have the same name as the engine-material (.mat) you want it to have. This is best accomplished by always letting the diffuse texture for the material have the same name as the engine-material (e.g. "​dirt_road.dds"​ and "​dirt_road.mat"​). What happens when the model is loaded is that the engine checks the diffuse texture for the current submesh and then replaces the extention (eg "​.dds",​ "​.tga",​ etc) with "​.mat"​ and then tries to load a material with that file name.\\  +In order to have a mesh with multiple material you must have several submeshes (or whatever the name of discrete objects in the editor) each with its own material and with different names of the diffuse texture. For example say you are making a character that requires a two materials, one for the hair and one for the body. You then first need to make sure that the hair and body are separate submeshes, then give each one their own material. The body's material can then have the diffuse map: "​character_body.dds"​ and the hair's material can have "​character_hair.dss"​. The engine will now use two different materials to load this character.\\
-**Note:** When using the modelviewer,​ it will automatically create the "​.mat"​-file if one does not exist, and thus an engine-material does not need to be created by hand if the names of the texture are set up as described [[here]]. +
- +
- +
-**__Multiple Materials__ ** \\  +
-In order to have a mesh with multiple material you must have several submeshes (or whatever the name of discrete objects in the editor) each with its own material and with different names of the diffuse texture. For example say you are making a character that requires a two materials, one for the hair and one for the body. You then first need to make sure that the hair and body are separate submeshes, then give each one their own material. The body's material can then have the diffuse map: "​character_body.dds"​ and the hair's material can have "​character_hair.dss"​. The engine will now use two different materials to load this character.\\ ​+
 Note that this is the only way to go about! It is not possible to have polygon-IDs or whatever tricks the editor might have. One submesh can only have one material! Note that this is the only way to go about! It is not possible to have polygon-IDs or whatever tricks the editor might have. One submesh can only have one material!
- 
  
 ==== Animation ==== ==== Animation ====
- 
  
 ===== Maya ===== ===== Maya =====
- 
  
 ==== Setup ==== ==== Setup ====
  
- +**__Collada exporter settings__ ** \\ 
-**__Collada exporter settings__ ** \\  +Here is how the export tool should be set up:\\ 
-Here is how the export tool should be set up:\\  +{{:​hpl3:​engine:​maya_collada_export.jpg?​nolink&​170}}\\
-{{:​hpl3:​engine:​maya_collada_export.jpg?​nolink&​170}}\\ ​+
 (Click for large version) (Click for large version)
  
 +//Note: If you are using a newer exporter there could be issues with scaling, especially with detail meshes. Solution is to set the units to "​Centimeters"​.//​
 ==== Modelling ==== ==== Modelling ====
  
 +**__Material fails to export__ ** \\
 +If the model gets exported without any material check if any of this helps:\\
 +**1)** Check so that "​intitialshadingGroup"​ has not been connected to the model. If it has been, then simple set the same material to the model again and the problem will go away.\\
 +**2)** Check so that two materials have not been set on the same mesh. For having a mesh with multiply material see [[:​hpl3:​engine:​materials|General/​Modelling/​Multiple Materials]]
  
-**__Material fails to export__ ** \\  +==== Animation ====
-If the model gets exported without any material check if any of this helps:\\  +
-**1)** Check so that "​intitialshadingGroup"​ has not been connected to the model. If it has been, then simple set the same material to the model again and the problem will go away.\\  +
-**2)** Check so that two materials have not been set on the same mesh. For having a mesh with multiply material see [[:​hpl3:​engine:​materials|General/​Modelling/​Multiple Materials]] ​+
  
 +===== Looped animations =====
  
-==== Animation ====+It is prefered if looped animations are exported so that they have the same keyframe at the first and last position. This will guarantee that they are looped correctly.
  
 +===== Additional animation setup =====
  
-===== Looped animations =====+Additional information about the animation can be setup by adding a .anm_info file with the same name as the animation. This file can be used to specify advanced settings that might be hard to get correct when exporting. The anm_info file is stored as an xml document.
  
 +==== Bone Setup ====
  
-It is prefered ​if looped animations are exported so that they have the same keyframe at the first and last position. This will guarantee that they are looped correctly.+Information about which bones should be active for the animation can be specified in the file. You can either include or exclude bones. Each bone is specified with a name (wildcard allowed) and if it should affect all the children of the bone(s).
  
 +Here is an example of some XML code.
  
 +<​code>​
 +<​AnimationInfo>​
 +    <​BoneSetup>​
 +        <!-- Start by exluding all bones from this anim -->
 +        <Exclude Bone="​*"​ />
 +        <!-- Then include the top of the left arm and all its children -->
 +        <Include Bone="​j_L_Arm_1"​ Children="​true"​ />
 +        <!-- Then exlude the lower part of both arms using a wildcard -->
 +        <Exclude Bone="​j_*_Arm_3"​ Children="​true"​ />
 +    </​BoneSetup>​
 +</​AnimationInfo>​
 +</​code>​
 ===== 3DS Max ===== ===== 3DS Max =====
- 
  
 ==== Modelling ==== ==== Modelling ====
- 
  
 ==== Animation ==== ==== Animation ====
- 
  
 ===== Modo ===== ===== Modo =====
- 
  
 ==== Modelling ==== ==== Modelling ====
  
- +**__Mesh Setup__ ** \\
-**__Mesh Setup__ ** \\ +
 Every submesh in the scene need to have its own mesh layer and material for the texture and properties to be exported correctly. Every submesh in the scene need to have its own mesh layer and material for the texture and properties to be exported correctly.
  
- +**__Triangulate__ ** \\
-**__Triangulate__ ** \\ +
 The export tool does not triangulate the mesh autoatically so before exporting, you must enter geometry/​polygon/​triple in order for everything to be triangulated. The export tool does not triangulate the mesh autoatically so before exporting, you must enter geometry/​polygon/​triple in order for everything to be triangulated.
  
- +__**Unit Setup**__
-__**Unit Setup**__ ​ +
  
 It is important to have your grid/units set up correctly so that the scale of the meshes you create are 1:1 with that of the game's unit size. It is important to have your grid/units set up correctly so that the scale of the meshes you create are 1:1 with that of the game's unit size.
- 
  
 To do this, navigate to the System drop-down>​Units:​ To do this, navigate to the System drop-down>​Units:​
  
- +Unit system: Game Units\\ 
-Unit system: Game Units\\  +Default unit: Game Units\\ 
-Default unit: Game Units\\  +Meters per Game Unit: 1.0\\ 
-Meters per Game Unit: 1.0\\  +Coordinate System: Up=Y
-Coordinate System: Up=Y\\+
  
 ==== Animation ==== ==== Animation ====
  
 +For animation it is highly recommended that you use the FBX format. Whilst it is possible to use collada .dae, the setup is tedious and output has mixed results.
  
-**Exporting a skeletal mesh without animations:** +**FBX format setup:**
  
 +Before exporting there'​s a couple of settings you should make sure are set in order for the pipeline to be smooth.
  
-It is usually advisable to do this so that animations are seperate in their own .dae_anim files. To do this, rig and skin your mesh as normalsimply make sure the skeleton and mesh items are visible in the layers.+Open System>​Preferences ​and under File I/Oselect FBX I/O.
  
 +Export Version: FBX 2013\\
 +Export type: Export Selection with hierarchy\\
 +Save as text format: no\\
 +Save only animation: no when exporting mesh / yes when exporting animation\\
 +Save cameras: no\\
 +Save lights: no\\
 +Save materials: yes\\
 +Save polygon parts: yes\\
 +Save selection sets: no\\
 +Save mesh smoothness: yes\\
 +Save morph maps: no\\
 +Save animation: no when exporting animation / yes when exporting animation\\
 +Sample animation: yes when exporting animation
  
-There are some important settings to apply before ​you export.+Exporting an animated mesh is broken down into two parts. First you need to export ​the mesh which has all the polygons and material informationBasically what is rendered.\\ 
 +The mesh must have a bone skeleton and has to be skinned/​rigged to it
  
 +Once your rigged mesh is exported you then have to export the animations. The animations should be exported as separate files for each action (walk, run, etc) and be in a folder named "​animations"​ next to your .fbx.\\
 +The animation files will just contain bone and keyframe data, and no rendered meshes.
  
-Go to system drop-down>​preferences>​Collada I/O:+**Exporting a skeletal mesh without animations:**
  
 +To export the mesh you wish to animate, you should check your export settings (seen above), make sure the following options are set:
  
-    * Save hidden itemsOFF +Save only animationno\\ 
-    ​* ​Save CamerasOFF +Save animationno
-    * Save lights: OFF +
-    * Save Locators: ON +
-    * Save Vertex Normals/UV Texture Coordines/​Vertex Colors/​Vertex Weights: ON +
-    * Save Animation: OFF +
-    * Sample Animation: OFF +
-    * All profile options: OFF \\ +
  
 +Make sure your meshes are triangulated.
  
-**Exporting a skeletal animation:​** ​+Select all mesh and bone items (double-click your root bone to select all connected). Only selected items will be exported.
  
 +Then File>​Export as…>​autodesk FBX 2013
  
-When the animation for your mesh is complete, the first thing to do is hide the mesh item, only have the bones visible in your layer stack, as there'​s no need for the mesh to be present in the exported file (since you exported the rigged mesh in seperate .dae in the previous step).+**Exporting ​skeletal animation:​**
  
 +Now it's time to export your animations. Again check your export settings (seen above) and make sure the following options are set:
  
-    * Now you need to bake your animations. To do this go to the animate drop-down>​Bake>​input your start and end frames>​ok. +Save only animation: ​yes\\ 
-    * Go to Item drop down>​Transform>​Purge unused transform, mode: All, type: All. This ensures over-rotation of bones don't occur. +Save animationyes\\ 
-    * Go to system drop-down>​Preferences>​Collada I/O: \\ Up axis: Change this to X, Y or Z if you experience your mesh being rotated 90 degrees on playing of animation. Can be changed back to Y when finished exporting animation. \\ Save hidden itemsOFF \\ Bake Matrices: ON \\ Save AnimationON \\ Sample ​Animation: OFF \\ All profile options: OFF +Sample ​animationyes
-    * File drop-down>​exportExport as collada .dae, then rename so the extention is .dae_anim. You may need to change your Windows folder settings to show extentions if you can't see them.+
  
 +Select all bone items (double-click your root bone to select all connected). Only selected items will be exported.
  
- \\+Then File>​Export as…> autodesk 
 + 
 +FBX 2013
  
 ===== Blender ===== ===== Blender =====
- 
  
 ==== Modelling ==== ==== Modelling ====
  
- +**__Triangulate__ ** \\
-**__Triangulate__ ** \\ +
 Currently you have to triangulate the model before it can be exported, there is no export only triangulate. Currently you have to triangulate the model before it can be exported, there is no export only triangulate.
- 
  
 ==== Animation ==== ==== Animation ====
  
hpl3/engine/model_export.1380918967.txt.gz · Last modified: 2013/10/04 20:36 by aaron.clifford