Skip to content

Colladaloader {documentation artist guide formats}

Luis Anton Rebollo edited this page Dec 5, 2013 · 1 revision

Contents

Introduction

COLLADA is an XML based file format, meaning DAE files may be opened, viewed and edited (if desired) in any text editor.

COLLADA is emerging as the format for interchanging models between DCC (digital-content-creation) applications. Torque 3D can load geometry, material and animation data directly from COLLADA (.dae) files. The Torque 3D COLLADA loader is based on version 1.4.1 of the COLLADA specification.

Many 3D modeling applications come with built-in COLLADA import and export functionality, but third party plugins are also available that may be more stable, updated more frequently and give better results. In particular, OpenCOLLADA is recommended for both Autodesk 3ds Max and Maya.

COLLADA <unit> scale

When creating a model, it makes sense to work in units appropriate to the type of object being modeled. For example, it may be convenient to model a building in meters (or feet), but a small object like a pen would be better modeled in cm (or inches). Normally the modeler would be forced to choose a single unit for both objects, and one object would end up having awkward measurements; like a building that is 2000 units high, or a pen that is only 0.14 units long.

This was often the case when exporting DTS models, since the convention for Torque 3D is that 1 Torque unit = 1 meter; forcing the modeler to always work in meters or apply a model-specific scale factor prior to export.

COLLADA provides a mechanism to specify the units used when modeling the object. This is very important, since it allows a set of objects modeled in completely different units to be imported into Torque 3D with the correct scale relative to each other. This is done using the COLLADA <unit> element, which appears near the top of the .dae file and specifies the units-per-meter used for all positional values in the file such as vertex and node positions, translation animations etc. Torque 3D uses this value as a global scale factor which is applied to the entire model on import.

Many modeling applications allow the user to specify the units to be used, or alternatively, the option may be available when exporting the model to COLLADA.

For example, if the model was created using feet as the unit, it would have a <unit> element as follows:

<unit meter="0.3048" name="foot"/>

Torque 3D would scale the entire model by 0.3048 to convert it to a common reference of 1 Torque unit-per-meter. If another model was loaded that had been modeled in meters, its <unit>element would look like this:

<unit meter="1.0" name="meter"/>

In this case, the model is already measured in meters and would not be scaled on import.

It is up to the modeler to ensure that models are created with appropriate units in mind. For example, if a chair was modeled at 5 units high in the modeling application (simply because that was a convenient value for the modeler), then exported to DAE with units set to feet, then the chair would appear to be the equivalent of 5 feet high in Torque 3D! The Torque 3D COLLADA import dialog allows you to override the <unit> scale specified in the DAE file, for cases like this when the modeler has not taken units into account.

COLLADA defines the following coordinate systems using the <up_axis> element:

The coordinate system in Torque 3D is equivalent to Z_UP, and the loader will automatically convert models using X_UP or Y_UP to this coordinate system. Some COLLADA exporters may generate models with a wrong or missing <up_axis> element (Z_UP is assumed if <up_axis> is not specified). In this case, the COLLADA import dialog can be used to override the value.

COLLADA for Torque 3D

The COLLADA loader supports polygonal geometry, simple materials (no support for embedded CG/GLSL shaders) and all forms of animation available in Torque 3D.

COLLADA camera, and physics elements are not supported. COLLADA lights may be instantiated in the current mission as part of importing the model.

Appendix 3: Supported COLLADA elements has a full listing of the elements that are supported.

Import Dialog

When a COLLADA model is first added using the World Editor, or opened in the Shape Editor, the COLLADA import dialog is displayed to control how Torque 3D will import the model.

  • The frame on the left displays the shape hierarchy, including nodes, geometry, lights, materials and animations.
  • LOD: Controls how level-of-detail is generated for the model:
    • DetectDTS: Attempts to detect whether the shape uses the DTS node markup scheme, and if found, uses TrailingNumber mode (below). If not detected, SingleSize mode is used. The shape is determined to be using DTS markup if there is a root level node called "base*" (where * is anything) with a child node called "start*". See Scene hierarchy and LOD for more details.
    • SingleSize: All geometry in the shape will be added to a single detail level, with size given by the value in the gui. The exception is collision meshes which will be at a fixed negative detail size.
    • TrailingNumber: The detail size for geometry in the shape will be determined by the number at the end of the node (or mesh, if the modeling app does not distinguish between the two) name. An underscore before the number will be interpreted as a negative sign. eg. "mesh1" (size=1), "mesh3 1" (size=1), "mesh_1" (size=-1)
  • Materials Prefix: Some COLLADA exporters generate <material> elements with generic names such as "texture1", "texture2" etc. This causes problems when the model is used in Torque since the names may clash with existing Materials. This option can be used to prefix all material names in the model so they will be unique. Press return after editing the field to update the tree view. The icon (and tooltip) next to the material name indicates whether there is already a script Material object mapped to that name.
  • Import Nodes: A list of semicolon separated node names (with wildcards) to always import, even if the name matches the Ignore Nodes list. This is similar to the AlwaysExport list used with DTS exporting. For example: mount*;cam;eye nodes. Press return after editing the field to update the tree view.
  • Ignore Nodes: A list of semicolon separated node names (with wildcards) to ignore on import, similar to the NeverExport list used with DTS exporting. For example: *-PIVOT;dummy. Press return after editing the field to update the tree view. Nodes that will be ignored are marked with a . Child nodes and geometry attached to an ignored node will still be imported.
  • Import Meshes: A list of semicolon separated mesh names (with wildcards) to always import, even if the name matches the Ignore Meshes list. For example: bounds;Body*. Press return after editing the field to update the tree view.
  • Ignore Meshes: A list of semicolon separated mesh names (with wildcards) to ignore on import. For example: *dummy. Press return after editing the field to update the tree view. Meshes that will be ignored are marked with a .
  • Override up_axis: Set this option to override the up_axis specified in the DAE file. A value of Z_UP means no coordinate transformation will be applied.
  • Override scale: Set this option to override the scale factor applied to the model on import. A value of 1.0 means the model will not be scaled.
  • Ignore bone scaling: Because of the way Torque bakes scale information into the mesh vertices, some skinned models will load with strange geometry (the mesh is still attached to the skeleton, but appears thin and stretched out). Re-importing the model with this option set should resolve the issue.
  • Center model: Setting this option causes the model to be translated such that the origin is at the center of the shape's bounding box.
  • Floor model: Setting this option causes the model to be translated (in the Z axis only) such that the origin is at the bottom of the shape's bounding box. It can be used along with Center Model so that the origin is also centered (ie. at the center of the feet of a character model).
  • Force update materials.cs: Setting this option causes the COLLADA loader to write all materials in the DAE file into a materials.cs script in the same folder, even if they are already mapped to another Torque Material. If not set, the COLLADA loader only creates Materials for material names that are unmapped.
  • Add lights to scene: If this option is set, a SimGroup will be created (suitable for converting to a prefab) containing the imported shape as well as PointLight and SpotLight objects for any lights in the DAE file. This option is only available when adding a model through the World Editor.
    Unlike the other import options, this setting is not persistent, so you will need to set it each time you want to import the lights. Prefabs are recommended where it makes sense for the model to always include the lights. For example, a streetlamp model may include a light source in the DAE file. The first time this model is imported into Torque, the Add lights to scene setting should be set, and the resulting SimGroup saved to a prefab so you can easily instantiate the model and light multiple times in the scene.
  • Load from .cfg: Loads the AlwaysImport and NeverImport lists from a DTS config file (either model_name.cfg or dtsScene.cfg, whichever is found first). This feature is useful when importing a scene previously setup for DTS export that used a config file to specify the AlwaysExport and NeverExport lists.
  • Save to .cfg: Saves the AlwaysImport and NeverImport lists to a DTS config file (model_name.cfg).

Geometry

The Torque 3D COLLADA importer supports all of the COLLADA polygonal geometry elements: <triangles>, <tristrips>, <trifans>, <polygons> and <polylist>, with non-triangular polygons automatically converted to triangles during loading. Note that if polygons are non-planar, this may introduce seams on the model, so the best option is to triangulate in the modeling application prior to exporting.

In previous versions of Torque, when exporting to DTS, a single mesh could not have more than around 11,000 triangles (the exact limit depends on the materials assigned to the mesh, and the number of shared vertices). The Torque 3D COLLADA loader however does not impose any limit on the number of vertices or polygons within a single mesh; it is up to the user to determine appropriate polygon counts for each model to ensure acceptable rendering performance.

Torque still uses 16-bit triangle indexing internally, so the COLLADA loader will automatically split meshes with too many polygons into multiple draw calls as required.

When exporting to DTS, it was required to adhere to a strict scene hierarchy in order to specify LOD. The COLLADA loader is a bit more flexible, and is designed to import scenes regardless of whether they have been prepared for DTS export or not. The traditional DTS scene export hierarchy appears below.

+-bounds                    bounds node
+-base01                    subshape
| +-start01                 shape branch
| | +-Collision-1           collision mesh
| | +-Shape128              mesh
| |
| +-detail128               detail
| +-detail2                 detail
| +-collision-1             collision detail
|
+-Shape2                    lower-detail
mesh

These models are loaded as normal (ie. the loader collects the detail markers and uses them to group meshes into a single object with multiple detail levels). The above model would appear in-game as:

+-base01
+-start01
+-Collision               Object Collision with details: -1
+-Shape                   Object Shape with details: 32 2

The loader also supports models that do not use the above layout. These scenes are detected by the absence of the baseXXX->startXXX hierarchy (where XXX is any string), and the entire scene is added to a single subshape with a single detail level size of 2 (the fixed size can be selected in the COLLADA import dialog).

For example, this model:

+-shape1
| +-Box01                   mesh
+-shape2
+-Cylinder01              mesh
+-Cylinder02              mesh
+-Box02                   mesh

Will be imported as:

+-shape1
| +-Box01                   Object Box01 with details: 2
|-shape2
+-Cylinder01                Object Cylinder01 with details: 2
+-Cylinder01                Object Cylinder02 with details: 2
+-Box3                    Object Box03 with details: 2

Note the following:

  • all objects have a single detail of size 2
  • trailing numbers have not been stripped from the object names

To summarize: if you're used to exporting scenes to DTS, you are welcome to keep using the DTS scene hierarchy, and the exported COLLADA model should import exactly the same. If you're new to Torque, or don't want to use the DTS scene markup anymore, just put the detail size as a number at the end of the mesh name, and select TrailingNumber as the LOD type in the COLLADA Import interface.

A 3Space bounding box is simply an axis-aligned cuboid that fits around the shape. Torque 3D uses the centre of the bounding box as the object's origin when placed in the world editor, and it may also be used for simple collision detection.

It is important therefore for the shape bounding box to have the correct size and position. When exporting DTS models, this was done by adding a mesh called bounds to the root level of the scene. The DTS exporter would detect this special name and use the bounds mesh geometry to compute the shape bounding box.

This option is still available to models exported to COLLADA, and may be preferable if the model is animated and you want exact control over the size and position of the bounding box. For example, a walking character animation may move the feet or arms of the model outside the box containing the shape in its root pose, so you can use a custom bounding box to explicitly specify the bounding box extents.

If the DAE model does not contain a root level <node> called bounds with geometry attached to it, the Torque 3D COLLADA importer will automatically calculate a bounding box that encloses all of the geometry in the scene. For animated models, only the root (non-animated) pose is considered. For static objects this is usually adequate.

Collision Meshes

Meshes exported to COLLADA can be marked as collision or line-of-sight collision meshes by setting the node or mesh name to Collision-X or LOSCol-X respectively, where X is a number from 1 to 8 in the case of collision meshes, or 9-16 in the case of LOS collision meshes. If your modeling application does not support -'s in names, use an underscore instead (eg. collision_1). The number at the end of the name denotes the detail size of the mesh.

Note that both types of mesh must be convex.

A mesh can be marked as a billboard prior to exporting to COLLADA by prefixing the name of the node that instantiates the mesh (or the mesh itself if the modeling application does not make that distinction) with BB:: (or BB_ if the app does not allow colons in names). Z billboards only rotate around their Z (vertical) axis to face the camera, and are specified by prefixing the node (or mesh) name with BBZ:: (or BBZ_).

To define an imposter detail level for a shape for export to COLLADA, simply create a node at the root level with no children or geometry attached, and prefix its name with BB:: (or BB_). Then set the following user properties on the node itself:

  • BB::DL
  • BB::DIM
  • BB::EQUATOR_STEPS
  • BB::POLAR_STEPS
  • BB::INCLUDE_POLES
  • BB::POLAR_ANGLE

Note: at the time of writing, only the OpenCOLLADA MAX exporter generates DAE files with the appropriate user properties to specify imposter settings. For other users, the Torque 3D Shape Editor can add and edit imposter detail levels.

Materials

In previous versions of Torque, and still when exporting to DTS, a Material was identified only by its diffuse texture. In Torque 3D, Materials encompass much more than just the diffuse texture (and may not have a diffuse texture at all), and are more akin to the materials defined in a modeling application. For this reason, the COLLADA loader names materials using the <material> element name, rather than the diffuse texture filename. For example, here is a typical material definition in a DAE file:

<library_images>
<image id="myTexture.png" name="myTexture_png">
<init_from>myTexture.png</init_from>
</image>
</library_images>
<library_materials>
<material id="COLLADAMat" name="COLLADAMat">
<instance_effect url="#COLLADAMat-fx"/>
</material>
</library_materials>

And the corresponding Torque Material definition:

new Material(myMat)
{
diffuseMap[0] = "myTexture";
mapTo = "COLLADAMat";
};

The mapTo field of the Torque Material must be set to the name of the <material> element in the DAE file (in this case "COLLADAMat"). For most COLLADA exporters, this will not be the same as the diffuse texture filename, and therefore the material will not display correctly without a script Material definition.

Fortunately, the COLLADA loader will auto-generate the materials.cs script for any unmapped materials defined in the DAE file. The initial properties of the Material are determined from the COLLADA <material> (see Appendix 1: Material settings for more details). For many Materials, these initial settings will be sufficient, but the Material Editor can be used to fine-tune properties if needed.

It should be noted that to avoid overwriting existing Materials, the COLLADA loader only generates Materials for unmapped material names. The COLLADA import dialog shows which materials are unmapped (and therefore, which Materials will be generated), and also allows you to force an update of materials.cs, including any mapped materials.

The COLLADA loader uses the following rules to determine the texture paths for the autogenerated Materials based on the path specified in the DAE file:

  1. Absolute paths that reference outside the Torque game folder will be ignored, and the texture path set to the model folder. For example, "D:\images\myTexture.jpg" will become "myTexture.jpg".
  2. Absolute paths that reference inside the Torque game folder will be used as expected. For example, "D:\Torque\game\art\myTexture.jpg" will become "art/myTexture.jpg".
  3. Relative paths will be appended to the model folder. For example, "./textures/myTexture.jpg" for a model in the "art/shapes/trees" folder will become "art/shapes/trees/textures/myTexture.jpg".

Animation

The following table summarizes the type of animations available using the COLLADA loader.

Animation Type Notes
Node transform Supported using animated COLLADA node transforms (rotate, translate etc).
Skeletal animation Supported using animated COLLADA node transforms (rotate, translate etc) with a <skin> controller to provide vertex weights.
Visibility Supported using the FCOLLADA <node> extension (with animated visibility).
UV (texture mapping) UV keyframe animation is not supported in Torque 3D. Certain UV transformations such as offset and rotation can be animated using the Material Editor.
Morph Morph (vertex keyframe) animation is not supported in Torque 3D.

Torque animation sequences are implemented using COLLADA <animation_clip> elements. If the DAE file contains <animation> elements, but does not contain any <animation_clip>s, the loader will automatically create a cyclic animation sequence called ambient using all of the <animation>s. You can use the Shape Editor tool to split this combined sequence into multiple sequences if required.

DAE to DTS

Torque's native model format, DTS, is much faster to read than COLLADA, so once a DAE file has been imported, the loader automatically saves the 3space model to a DTS file. For example, importing myShape.dae will generate myShape.cached.dts. The next time Torque attempts to load the DAE file, it compares the timestamps of the two files, and if the cached DTS is newer, then it loads that instead. Re-exporting the DAE (or modifying it by hand) will cause the DAE to be re-imported, and the cached DTS overwritten with the latest model.

Demos and released games can ship only the cached DTS files if desired. Torque will automatically load the cached DTS if the DAE is missing. Datablocks and mission files should continue to refer to the DAE file.

A console function is available to batch-convert a set of DAE files to DTS. The function takes a single argument that specifies a wildcard pattern to match DAE files to be converted. For example:

// convert ALL dae files in the game directory
convertCOLLADAModels("");
// convert all dae files in the art/shapes folder
convertCOLLADAModles("art/shapes/*.dae");
// convert dae files in the art folder with 'tree' in the filename
convertCOLLADAModels("art/*tree*.dae");

A command line tool, dae2dts, is also available for batch model conversion, or even for integration into a custom art pipeline. For example, a modeling app could be scripted to export to COLLADA, then call dae2dts to convert to DTS.

Google Earth (KMZ) models

Models exported from Google Sketchup or downloaded from the Google 3D warehouse can be loaded directly into Torque 3D. Just export the Sketchup (.skp) file to GoogleEarth 4 format (in Sketchup: File->Export->3D Model), which will produce a .kmz file. This is a normal zip file containing the DAE file and textures. For example:

cowboy.kmz
+-doc.kml
+-models
| +-cowboy.dae
+-images
+-texture0.jpg
+-texture1.jpg
+-texture2.jpg

Torque understands that this is really just a zip file, and you don't even need to unzip it to load the COLLADA model! KMZ files will appear in the Torque 3D World Editor in the same way as DTS and DAE files. When the model is imported, Torque 3D will automatically extract the converted DAE file and textures into the KMZ folder, but mission files and datablocks should continue to refer to the KMZ file itself. For example:

datablock PlayerData(CowboyData : DefaultPlayerData)
{
shapeFile = "~/data/shapes/players/cowboy.kmz";
renderFirstPerson = false;
emap = true;
};

Note that the .kmz file is treated as a normal directory ("cowboy" with no .kmz extension), and the path inside the .kmz file is required (models/cowboy.dae).

NOTE: Sketchup 7 and later can export directly to COLLADA, so there is no need to use KMZ files unless desired.

NOTE: There is a known bug in the Google Sketchup 6 COLLADA exporter, in that it exports materials with the transparency inverted (1.0 - transparency). The Torque COLLADA loader automatically corrects this.

NOTE: One caution with this type of file is that all materials are exported as double-sided (using the GOOGLEEARTH extension, see Appendix 2: Supported Extensions). For most models this is not desired, as it means the GPU will not cull backfaces (triangles not facing the camera) and render polygons twice. The double-sided property can be disabled for the relevant Material using the Material Editor.

Troubleshooting

1. Torque crashes when loading or displaying a COLLADA model

Support for COLLADA in Torque 3D is still relatively new - it is possible that bugs or non-standard models will cause Torque to crash. If you think this is the case, please report the issue in the Torque 3D bug report forums, along with the model (if possible) and a description of how to reproduce the problem. Providing a sample model and a clear, detailed bug report is by far the most effective way to get the problem resolved.

2. Materials are missing/wrong

A major difference between a COLLADA and a DTS model is in the naming of materials. Materials in DTS files are generally named using the diffuse texture filename. For example, a DTS material that uses the texture wood.jpg would be called wood. When Torque loads this model, if there are no script Materials defined that mapTo wood, the engine looks for a JPG, PNG or BMP file with that name in the same directory as the model.

However, in a modeling application, a material usually encompasses much more than just the diffuse texture. When a model is exported to the COLLADA file format, the name of the material in the modeling app is stored in the <material> tag in the COLLADA file.

It is this <material> name that is used by the COLLADA loader as the name of the Material in Torque. If no script Material is defined that maps to this name, the engine will look for a JPG, PNG, TGA or BMP texture in the same way. So there are two approaches to get materials to show up correctly for COLLADA models:

  1. Name the material in the 3D app the same as the diffuse texture file.
  2. Create a materials.cs file in the same directory as the model, and define a script Material object that maps to each COLLADA material. This is the recommended approach.

After importing, use the Material Editor tool (or manually inspect the materials.cs script) to modify material settings if required.

3. COLLADA models are slow to load or render

The Torque DTS file format is a binary format designed to make loading models into Torque extremely fast - in many cases, whole arrays of data are loaded directly into memory with no conversion at all.

By contrast, the COLLADA file format is an extremely flexible human-readable text format - but that flexibility comes at a cost. Arrays of numbers need to be converted to their binary equivalents, and the structure and layout of a COLLADA model needs to be converted into the form expected by Torque. It will always be much slower to load a COLLADA file than a Torque DTS model.

To get around this limitation, the loader automatically saves the converted COLLADA model to a DTS file. For example, myModel.dae will be saved to myModel.cached.dts when it is first loaded by Torque. The next time the model is loaded, the cached DTS will be loaded instead, which will be much faster. If the COLLADA model changes (ie. myModel.dae has a modification time later than myModel.cached.dts), Torque will reload the COLLADA file, and overwrite the cached DTS file with the new model data.

These 'cached' DTS files can be shipped instead of the DAE files with a demo or game to avoid having to release the text-format COLLADA files. If the DAE is not present, Torque will always load the cached DTS. Datablocks and mission files should continue to point at the DAE file.

Another thing to consider is the polygon count of the model. COLLADA models are essentially unlimited in the number of polygons that they support. All that data needs to be loaded into memory before converting to 3space (which supports only 16 bit triangle indices, meaning larger meshes may need to be split up). As well as being slow to load, a model with too many polygons will also lead to poor rendering performance.

4. Model transparency is incorrect

Some exporters do not comply with the COLLADA specification when it comes to material transparency. For example Google Sketchup 6 always exports materials with the transparency inverted (1.0 - transparency). The Torque COLLADA loader attempts to detect inverted transparency automatically (a warning message will be generated in the console for all converted elements).

Check the transparency elements of each material in the .dae file. If the opaque attribute of the <transparent> element is missing or set to A_ONE, then the COLLADA loader calculates transparency as:

1.0 - (<transparency> * <transparent>[3])

If the opaque attribute is set to RGB_ZERO, then transparency is calculated as:

<transparency> * ((<transparent>[0] + <transparent>[1] + <transparent>[2]) / 3)

Transparency, as well as other Material properties, can be easily corrected in the Material Editor.

5. Geometry is missing or the wrong size

  • Check the console for warnings or errors. In particular, note that the COLLADA loader only supports polygonal geometry, and will generate a warning message such as:

    COLLADA <xxx> element in YYY is not supported.

    if it encounters unsupported geometry such as <line>, <spline> <capsule> etc. The best option is to convert non-polygonal geometry in your modeling application prior to export, but you could also try the COLLADA Refinery toolchain.
  • Try importing the model back into your modeling application. If this fails, or gives unexpected results, there may be a problem with the COLLADA export feature of your modeling application.
  • Check that you have set up your scene correctly for LOD. The Shape Editor tool may be used to inspect the detail levels present in the model.
  • Check the scale of the object. At the top of the .dae file, there is usually an element similar to this:
    <unit name="inches" meter="0.0254"/>
    This value represents the units that the model is measured in, and is applied as a global scaler to the entire model by the COLLADA loader. Unfortunately, not all applications have the same idea of scale, so a model that is 1 meter high might be very large in one application but very small in another. The <unit> value is displayed and can be overridden in the COLLADA import dialog, so try increasing or decreasing the value by a factor of 10 or 100 to see if the model becomes visible.

6. Skinned meshes are distorted

  • Check the console for warnings or errors. The COLLADA loader will generate such messages if it encounters problems with the model.
  • If the mesh is correctly attached to the skeleton, but appears "stretched out", try re-importing the model with the Ignore bone scaling option set in the Import Dialog.
  • Try re-importing the model with the Override up_axis set to Z_UP (to prevent the loader applying a coordinate-system transformation) and Override scale set to 1.0 (to prevent the loader applying a global scaler).
  • Try re-exporting the model with the Bake Transforms or Single Matrix option set in the exporter.
  • If bones are missing from the shape (making the skinned mesh appear crushed in on itself), make sure everything in the scene is unhidden/unfrozen prior to exporting. Some COLLADA exporters will not export correctly if scene elements are hidden or frozen.

7. Some bones do not animate correctly

Torque stores animations as a series of regularly spaced keyframes. COLLADA supports this method as well, but animations may also be exported as animation curves defined by control points. In both cases, the COLLADA loader samples the animation data to produce a set of keyframes for Torque. The sampling frequency is determined by finding the minimum time between exported keyframes (clamped to a rate of 15-60 frames per second).

For COLLADA animations exported with the Sample Animation option set, this method will sample the exact exported keyframes, meaning no interpolation is required, and the animation should play perfectly in Torque.

For animations exported as curve control points, the loader must interpolate between points. This can sometimes cause problems if the animation curves are not continuous; for example, if a rotation angle wraps around from +180 to -180 degrees. The symptom of this issue is bones flipping around on some frames when the animation is played in Torque. This can be resolved by setting the Sample Animation and/or Single Matrix/Baked Transform export options.

Appendix 1: Material settings

This table shows how COLLADA <material>s are mapped to Torque Materials.

Material setting COLLADA <material> mapping
mapTo The name of the <material> element.
diffuseMap[0] Resolved to an <image> filename using the shader <diffuse>.<texture> element.
normalMap[0] Resolved to an <image> filename using the FCOLLADA <extra> profile <bump>.<texture> element.
specularMap[0] Resolved to an <image> filename using the shader <specular>.<texture> element.
diffuseColor[0] Shader type Value
<constant> 1 1 1 1
<blinn> blinn.diffuse
<lambert> lambert.diffuse
<phong> phong.diffuse
specular[0] Shader type Value
<constant> constant.reflective
<blinn> blinn.specular
<lambert> lambert.reflective
<phong> phong.specular
specularPower[0] Shader type Value
<constant> constant.reflectivity
<blinn> blinn.shininess
<lambert> lambert.reflectivity
<phong> phong.shininess
doubleSided This flag is set if any of the supported extensions have the <double_sided> flag set.
translucent If the shader <transparent> opaque attribute is missing or set to A_ONE, translucency is:
1.0 - (<transparency> * <transparent>[3])
Else if the opaque attribute is set to RGB_ZERO:
<transparency> * ((<transparent>[0] + <transparent>[1] + 
<transparent>[2]) / 3)
This flag is set if the translucency calculated above != 0.
translucentBlendOp translucency > 0 and <= 1 blendOp = LerpAlpha
diffuse[0].alpha = translucency
translucency > 1 blendOp = Add
diffuse[0].alpha = translucency - 1
translucency < 0 blendOp = Sub
diffuse[0].alpha = -translucency

Appendix 2: Supported Extensions

COLLADA allows application vendors to extend the COLLADA specification to provide application-specific features that are not yet supported natively in COLLADA. These extensions are contained within the <extra> tag and can appear almost anywhere in the COLLADA model file.

The Torque COLLADA loader supports the following extensions:

1. <texture> MAYA

This extension specifies a transform which is applied to the UV coordinates of any triangles that use the material. It is only supported for the <diffuse> texture of a material. See Maya Texture Placement - MAYA Extension for more details.

Element name Supported Animatable
wrapU, wrapV Yes No
mirrorU, mirrorV No No
coverageU, coverageV No No
translateFrameU, translateFrameV No No
rotateFrame No No
stagger No No
fast No No
repeatU, repeatV Yes No
offsetU, offsetV Yes No
rotateUV Yes No
noiseU, noiseV Yes No
<diffuse>
<texture texture="file1-sampler" texcoord="TEX0">
<extra>
<technique profile="MAYA">
<wrapU>1</wrapU>
<wrapV>1</wrapV>
<mirrorU>0</mirrorU>
<mirrorV>0</mirrorV>
<coverageU>1</coverageU>
<coverageV>1</coverageV>
<translateFrameU>0</translateFrameU>
<translateFrameV>0</translateFrameV>
<rotateFrame>0</rotateFrame>
<stagger>0</stagger>
<fast>0</fast>
<repeatU>1</repeatU>
<repeatV>1</repeatV>
<offsetU>0</offsetU>
<offsetV>0</offsetV>
<rotateUV>0</rotateUV>
<noiseU>0</noiseU>
<noiseV>0</noiseV>
</technique>
</extra>
</texture>
</diffuse>

2. <profile_COMMON> GOOGLEEARTH

This extension allows materials to be double sided (ie. viewable from both sides of a triangle). Any geometry using the material that references the effect will be double sided. There are a number of different extensions that set the double sided flag - if any of them are set, the geometry will be double sided.

Element name Supported Animatable
double_sided Yes No
<effect id="my-effect" name="my-effect">
<profile_COMMON>
...
<extra>
<technique profile="GOOGLEEARTH">
<double_sided>1</double_sided>
</technique>
</extra>
</profile_COMMON>
</effect>

3. <effect> MAX3D

This extension allows materials to be double sided (ie. viewable from both sides of a triangle). Any geometry using the material that references the effect will be double sided. There are a number of different extensions that set the double sided flag - if any of them are set, the geometry will be double sided.

Element name Supported Animatable
faceted No No
double_sided Yes No
wireframe No No
face_map No No
<effect>
...
<extra>
<technique profile="MAX3D">
<faceted>0</faceted>
<double_sided>0</double_sided>
<wireframe>0</wireframe>
<face_map>0</face_map>
</technique>
</extra>
</effect>

4. <profile_COMMON> FCOLLADA

This extension allows the normal map (bump map) for a material to be specified. The <bump>.<texture> element specifies a sampler2D in the same way as the <diffuse> and <specular> elements do.

Element name Supported Animatable
bump Yes No
<effect>
<profile_COMMON>
...
<extra>
<technique profile="FCOLLADA">
<bump>
<texture texture="normal-sampler" texcoord="TEX0">
</bump>
</technique>
</extra>
</profile_COMMON>
</effect>

5. <geometry> MAYA

This extension allows materials to be double sided (ie. viewable from both sides of a triangle). Any geometry using the material that references the effect will be double sided. There are a number of different extensions that set the double sided flag – if any of them are set, the geometry will be double sided.

Element name Supported Animatable
double_sided Yes No
<geometry>
...
<extra>
<technique profile="MAYA">
<double_sided>1</double_sided>
</technique>
</extra>
</geometry>

This extension allows the visibility of a node (and all objects attached to that node) to be animated, and also to attach custom properties to a node (such as those used to specify Auto Billboard parameters).

Note that when node visibility is computed, the entire node hierarchy is taken into account, so if a node is at 10% visibility, and its parent node is at 50% visibility, the computed node visibility will be 5%.

Element name Supported Animatable
visibility Yes Yes
user_properties Yes No
<node id="my-node" type="NODE">
...
<extra>
<technique profile="FCOLLADA">
<visibility sid="my_vis">1</visibility>
<user_properties>BB::DIM=128 &#13;&#13;
BB::EQUATOR_STEPS=12 &#13;&#13;
BB::POLAR_STEPS=6 </user_properties>
</technique>
</extra>
</node>

Appendix 3: Supported COLLADA elements

Element Name

Supported

Notes

<accessor> yes  
<alpha_func> no COLLADA Shader elements are not supported
<alpha_test_enable> no COLLADA Shader elements are not supported
<alpha> No COLLADA Shader elements are not supported
<ambient> no This element is not supported
<angular_velocity> no COLLADA Physics is not supported
<angular> no COLLADA Physics is not supported
<animation_clip> yes Animation clips are equivalent to Torque sequences. If no animation_clips are defined, but the document contains animations, a single clip is created that contains all animations.
<animation> yes  
<annotate> no COLLADA Shader elements are not supported
<argument> no COLLADA Shader elements are not supported
<array> no COLLADA Shader elements are not supported
<asset> yes Most fields are ignored. Only <unit> and <up_axis> have any effect.
<attachment> no COLLADA Physics is not supported
<author> ignored  
<authoring_tool> ignored  
<auto_normal_enable> no COLLADA Shader elements are not supported
<bind_material> yes  
<bind_vertex_input> yes  
<bind> yes  
<blend_color> no COLLADA Shader elements are not supported
<blend_enable> no COLLADA Shader elements are not supported
<blend_equation_separate> no COLLADA Shader elements are not supported
<blend_equation> no COLLADA Shader elements are not supported
<blend_func_separate> no COLLADA Shader elements are not supported
<blend_func> no COLLADA Shader elements are not supported
<blinn> yes  
<bool_array> yes  
<border_color> no  
<box> no COLLADA loader does not yet auto-generate box geometry.
<camera> no Camera elements are not supported
<capsule> no Torque does not support non-polygonal geometry
<channel> yes  
<channels> yes  
<clear_color> no COLLADA Shader elements are not supported
<clear_depth> no COLLADA Shader elements are not supported
<clear_stencil> no COLLADA Shader elements are not supported
<clip_plane_enable> no COLLADA Shader elements are not supported
<clip_plane> no COLLADA Shader elements are not supported
<code> no COLLADA Shader elements are not supported
<COLLADA> yes  
<color_clear> no COLLADA Shader elements are not supported
<color_logic_op_enable> no COLLADA Shader elements are not supported
<color_mask> no COLLADA Shader elements are not supported
<color_material_enable> no COLLADA Shader elements are not supported
<color_material> no COLLADA Shader elements are not supported
<color_target> no COLLADA Shader elements are not supported
<color> yes  
<comments> ignored  
<common_color_or_texture_type> yes  
<compiler_target> no COLLADA Shader elements are not supported
<connect_param> no  
<constant> yes  
<contributor> ignored  
<control_vertices> no <spline> is not supported
<controller> yes  
<convex_mesh> no COLLADA loader does not auto-generate convex meshes.
<copyright> ignored  
<created> ignored  
<cull_face_enable> no COLLADA Shader elements are not supported
<cull_face> no COLLADA Shader elements are not supported
<cylinder> no Torque does not support non-polygonal geometry
<damping> no COLLADA Physics is not supported
<data> no Embedded image data is not yet supported
<density> no COLLADA Physics is not supported
<depth_bounds_enable> no COLLADA Shader elements are not supported
<depth_bounds> no COLLADA Shader elements are not supported
<depth_clamp_enable> no COLLADA Shader elements are not supported
<depth_clear> no COLLADA Shader elements are not supported
<depth_func> no COLLADA Shader elements are not supported
<depth_mask> no COLLADA Shader elements are not supported
<depth_range> no COLLADA Shader elements are not supported
<depth_target> no COLLADA Shader elements are not supported
<depth_test_enable> no COLLADA Shader elements are not supported
<diffuse> yes Mapped to Material diffuse[0]
<directional> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<dither_enable> no COLLADA Shader elements are not supported
<draw> no COLLADA Shader elements are not supported
<dynamic_friction> no COLLADA Physics is not supported
<dynamic> no COLLADA Physics is not supported
<effect> yes  
<emission> no  
<enabled> no COLLADA Physics is not supported
<equation> no <plane> is not supported
<extra> yes See Appendix 2 for a list of supported extensions.
<float_array> yes  
<float> yes  
<fog_color> no COLLADA Shader elements are not supported
<fog_coord_src> no COLLADA Shader elements are not supported
<fog_density> no COLLADA Shader elements are not supported
<fog_enable> no COLLADA Shader elements are not supported
<fog_end> no COLLADA Shader elements are not supported
<fog_mode> no COLLADA Shader elements are not supported
<fog_state> no COLLADA Shader elements are not supported
<force_field> no COLLADA Physics is not supported
<format_hint> no  
<format> no  
<front_face> no COLLADA Shader elements are not supported
<func> no COLLADA Shader elements are not supported
<generator> no COLLADA Shader elements are not supported
<geometry> yes  
<half_extents> no <box> element is not supported
<height> no COLLADA Physics is not supported
<hollow> no COLLADA Physics is not supported
<IDREF_array> yes  
<image> yes  
<imager> no Camera elements are not supported
<include> no COLLADA Shader elements are not supported
<index_of_refraction> no  
<inertia> no COLLADA Physics is not supported
<init_as_null> no  
<init_as_target> no  
<init_cube> no  
<init_from> yes  
<init_planar> no  
<init_volume> no  
<input> yes  
<instance_animation> yes  
<instance_camera> no Camera elements are not supported
<instance_controller> yes  
<instance_effect> yes  
<instance_force_field> no COLLADA Physics is not supported
<instance_geometry> yes  
<instance_light> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<instance_material> yes  
<instance_node> yes  
<instance_physics_material> no COLLADA Physics is not supported
<instance_physics_model> no COLLADA Physics is not supported
<instance_physics_scene> no COLLADA Physics is not supported
<instance_rigid_body> no COLLADA Physics is not supported
<instance_rigid_contraint> no COLLADA Physics is not supported
<instance_visual_scene> yes  
<int_array> yes  
<interpenetrate> no COLLADA Physics is not supported
<joints> yes  
<keywords> ignored  
<lambert> yes  
<layer> no  
<library_animation_clips> yes  
<library_animations> yes  
<library_cameras> no Camera elements are not supported
<library_controllers> yes  
<library_effects> yes  
<library_force_fields> no COLLADA Physics is not supported
<library_geometries> yes  
<library_images> yes  
<library_lights> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<library_materials> yes  
<library_nodes> yes  
<library_physics_materials> no COLLADA Physics is not supported
<library_physics_models> no COLLADA Physics is not supported
<library_physics_scenes> no COLLADA Physics is not supported
<library_visual_scenes> yes  
<light_ambient> no COLLADA Shader elements are not supported
<light_constant_attenuation> no COLLADA Shader elements are not supported
<light_diffuse> no COLLADA Shader elements are not supported
<light_enable> no COLLADA Shader elements are not supported
<light_linear_attenuation> no COLLADA Shader elements are not supported
<light_model_ambient> no COLLADA Shader elements are not supported
<light_model_color_control> no COLLADA Shader elements are not supported
<light_model_local_viewer_enable> no COLLADA Shader elements are not supported
<light_model_two_side_enable> no COLLADA Shader elements are not supported
<light_position> no COLLADA Shader elements are not supported
<light_quadratic_attenuation> no COLLADA Shader elements are not supported
<light_specular> no COLLADA Shader elements are not supported
<light_spot_cutoff> no COLLADA Shader elements are not supported
<light_spot_direction> no COLLADA Shader elements are not supported
<light_spot_exponent> no COLLADA Shader elements are not supported
<light> no Light elements are not supported
<lighting_enable> no COLLADA Shader elements are not supported
<lights> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<limits> no COLLADA Physics is not supported
<line_smooth_enable> no COLLADA Shader elements are not supported
<line_stipple_enable> no COLLADA Shader elements are not supported
<line_stipple> no COLLADA Shader elements are not supported
<line_width> no COLLADA Shader elements are not supported
<linear> no COLLADA Physics is not supported
<lines> no Torque does not support non-polygonal geometry
<linestrips> no Torque does not support non-polygonal geometry
<logic_op_enable> no COLLADA Shader elements are not supported
<logic_op> no COLLADA Shader elements are not supported
<lookat> yes  
<magfilter> no  
<mass_frame> no COLLADA Physics is not supported
<mass> no COLLADA Physics is not supported
<material_ambient> no COLLADA Shader elements are not supported
<material_diffuse> no COLLADA Shader elements are not supported
<material_emission> no COLLADA Shader elements are not supported
<material_shininess> no COLLADA Shader elements are not supported
<material_specular> no COLLADA Shader elements are not supported
<material> yes  
<matrix> yes  
<mesh> yes  
<minfilter> no  
<mip_levels> no  
<mipfilter> no  
<mipmap_bias> no  
<mipmap_generate> no  
<mipmap_maxlevel> no  
<model_view_matrix> no Camera elements are not supported
<modified> ignored  
<modifier> no  
<morph> yes  
<multisample_enable> no COLLADA Shader elements are not supported
<Name_array> yes  
<name> no  
<newparam> yes  
<node> yes  
<normalize_enable> no COLLADA Shader elements are not supported
<optics> no Camera elements are not supported
<option> no Torque does not compress data
<orthographic> no Camera elements are not supported
<p> yes  
<param> yes  
<pass> no  
<perspective> no Camera elements are not supported
<phong> yes  
<physics_material> no COLLADA Physics is not supported
<physics_model> no COLLADA Physics is not supported
<physics_scene> no COLLADA Physics is not supported
<plane> no Torque does not support non-polygonal geometry
<point_distance_attenuation> no COLLADA Shader elements are not supported
<point_fade_threshold_size> no COLLADA Shader elements are not supported
<point_size_max> no COLLADA Shader elements are not supported
<point_size_min> no COLLADA Shader elements are not supported
<point_size> no COLLADA Shader elements are not supported
<point_smooth_enable> no COLLADA Shader elements are not supported
<point> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<polygon_mode> no COLLADA Shader elements are not supported
<polygon_offset_fill_enable> no COLLADA Shader elements are not supported
<polygon_offset_line_enable> no COLLADA Shader elements are not supported
<polygon_offset_point_enable> no COLLADA Shader elements are not supported
<polygon_offset> no COLLADA Shader elements are not supported
<polygon_smooth_enable> no COLLADA Shader elements are not supported
<polygon_stipple_enable> no COLLADA Shader elements are not supported
<polygons> Yes This element is supported. Non-triangular polygons are automatically converted to triangles during loading.
<polylist> Yes This element is supported. Non-triangular polygons are automatically converted to triangles during loading.
<precision> no Torque assumes all values have 32-bit precision.
<profile_CG> no COLLADA Shader elements are not supported
<profile_COMMON> no COLLADA Shader elements are not supported
<profile_GLES> no COLLADA Shader elements are not supported
<profile_GLSL> no COLLADA Shader elements are not supported
<projection_matrix> no COLLADA Shader elements are not supported
<radius> no COLLADA Physics is not supported
<radius1> no COLLADA Physics is not supported
<radius2> no COLLADA Physics is not supported
<range> no  
<ref_attachment> no COLLADA Physics is not supported
<reflective> yes Mapped to specular[0]
<reflectivity> yes Mapped to specularPower[0]
<render> no COLLADA Shader elements are not supported
<rescale_normal_enable> no COLLADA Shader elements are not supported
<restitution> no COLLADA Physics is not supported
<revision> ignored  
<RGB> no  
<rigid_body> no COLLADA Physics is not supported
<rigid_constraint> no COLLADA Physics is not supported
<rotate> yes  
<sample_alpha_to_coverage_enable> no COLLADA Shader elements are not supported
<sample_alpha_to_one_enable> no COLLADA Shader elements are not supported
<sample_coverage_enable> no COLLADA Shader elements are not supported
<sampler_state> no COLLADA Shader elements are not supported
<sampler> yes  
<sampler1D> no  
<sampler2D> yes  
<sampler3D> no  
<samplerCUBE> no COLLADA Shader elements are not supported
<samplerDEPTH> no COLLADA Shader elements are not supported
<samplerRECT> no COLLADA Shader elements are not supported
<scale> yes  
<scene> yes  
<scissor_test_enable> no COLLADA Shader elements are not supported
<scissor> no COLLADA Shader elements are not supported
<semantic> yes  
<setparam> no  
<shade_model> no COLLADA Shader elements are not supported
<shader> no COLLADA Shader elements are not supported
<shape> no COLLADA Physics is not supported
<shininess> yes Mapped to specularPower[0]
<size> no  
<skeleton> yes  
<skew> yes  
<skin> yes  
<source_data> ignored  
<source> yes  
<specular> yes Mapped to specularPower[0]
<sphere> no Torque does not support non-polygonal geometry.
<spline> no Torque does not support non-polygonal geometry
<spot> no Light elements are loaded in a separate pass using the loadCOLLADALights console function (available by checking the Add Lights checkbox in the import gui)
<spring> no COLLADA Physics is not supported
<static_friction> no COLLADA Physics is not supported
<stencil_clear> no COLLADA Shader elements are not supported
<stencil_func_separate> no COLLADA Shader elements are not supported
<stencil_func> no COLLADA Shader elements are not supported
<stencil_mask_separate> no COLLADA Shader elements are not supported
<stencil_mask> no COLLADA Shader elements are not supported
<stencil_op_separate> no COLLADA Shader elements are not supported
<stencil_op> no COLLADA Shader elements are not supported
<stencil_target> no COLLADA Shader elements are not supported
<stencil_test_enable> no COLLADA Shader elements are not supported
<stiffness> no COLLADA Physics is not supported
<subject> ignored  
<surface>    
<swing_cone_and_twist> no COLLADA Physics is not supported
<tapered_capsule> no Torque does not support non-polygonal geometry.
<tapered_cylinder> no Torque does not support non-polygonal geometry.
<target_value> no COLLADA Physics is not supported
<targets> yes  
<technique_common> yes  
<technique_hint> no  
<technique> yes See Appendix 2 for a list of supported extensions.
<texcombiner> no COLLADA Shader elements are not supported
<texcoord> no  
<texenv> no COLLADA Shader elements are not supported
<texture_env_color> no COLLADA Shader elements are not supported
<texture_env_mode> no COLLADA Shader elements are not supported
<texture_pipeline_enable> no COLLADA Shader elements are not supported
<texture_pipeline> no COLLADA Shader elements are not supported
<texture_unit> no COLLADA Shader elements are not supported
<texture> yes  
<texture1D_enable> no COLLADA Shader elements are not supported
<texture1D> no COLLADA Shader elements are not supported
<texture2D_enable> no COLLADA Shader elements are not supported
<texture2D> no COLLADA Shader elements are not supported
<texture3D_enable> no COLLADA Shader elements are not supported
<texture3D> no COLLADA Shader elements are not supported
<textureCUBE_enable> no COLLADA Shader elements are not supported
<textureCUBE> no COLLADA Shader elements are not supported
<textureDEPTH_enable> no COLLADA Shader elements are not supported
<textureDEPTH> no COLLADA Shader elements are not supported
<textureRECT_enable> no COLLADA Shader elements are not supported
<textureRECT> no COLLADA Shader elements are not supported
<title> ignored  
<translate> yes  
<transparency> yes  
<transparent> yes  
<triangles> yes  
<trifans> yes Auto converted to triangle lists during loading.
<tristrips> yes Auto converted to triangle lists during loading.
<unit> yes Only the root <unit> (the one under <COLLADA> has effect. This value is used as a global scaler applied to the whole model.
<up_axis> no Models that use X_UP or Y_UP will be automatically converted to Z_UP by the COLLADA loader.
<usertype> no  
<value> no  
<velocity> no COLLADA Physics is not supported
<vertex_weights> yes  
<vertices> yes  
<viewport_ratio> no  
<visual_scene> yes  
<wrap_p> no  
<wrap_s> yes May be overridden by the MAYA <texture> extension
<wrap_t> yes May be overridden by the MAYA <texture> extension

Conclusion

This article was intended to give you an overview of the COLLADA Loader system in Torque 3D. As an artist, you can always refer back to this doc to see what features are supported by the tech while you are generating assets.

Clone this wiki locally