Game Development Community

dae2dts doesn't export biped-model LODS with fix

by Richard Marrevee · in Torque 3D Professional · 08/29/2011 (1:31 pm) · 4 replies

I don't know if this has been brought up earlier (did a search, but couldn't find anything:(, allthough I think I remember seeing something like this ) but I'm having difficulties converting a character (and biped/bones) with a few LOD's DAE-file with dae2dts. For some reason dae2dts changes all the detail level to 2.

When loading the DAE into te shape-editor and setting the LOD-detection to trailing numbers, everything works fine, the generated dts included.

Anybody knows something about this behaviour?

Thanks

Edit: Changed the title to a better description of the problem.

Edit 2: Fix included in post #3

About the author

Started programming in 1984 on an Oric, when time progressed switched to MSX, Amiga and finally the Windows PC with T3D. Now developing an epic fantasy game: The Master's Eye. Creator of the DoorClass pack and VolumetricFog pack @ richardsgamestudio.com


#2
09/02/2011 (12:34 pm)
I'll have Chris take a look at this
#3
09/03/2011 (4:27 am)
I've found it.

In ColladaShapeLoader.cpp in function enumerateScene() around line 256 change:

case ColladaUtils::ImportOptions::DetectDTS:
         // Check for a baseXX->startXX hierarchy at the top-level, if we find
         // one, use trailing numbers for LOD, otherwise use a single size
         for (int iNode = 0; singleDetail && (iNode < sceneNodes.size()); iNode++) {
            domNode* node = sceneNodes[iNode];
            if (dStrStartsWith(_GetNameOrId(node), "base")) {
               for (int iChild = 0; iChild < node->getNode_array().getCount(); iChild++) {
                  domNode* child = node->getNode_array()[iChild];
                  if (dStrStartsWith(_GetNameOrId(child), "start")) {
                     singleDetail = false;
                     break;
                  }
               }
            }
         }
         break;

into this:

case ColladaUtils::ImportOptions::DetectDTS:
         // Check for a baseXX->startXX hierarchy at the top-level, if we find
         // one, use trailing numbers for LOD, otherwise use a single size
         for (int iNode = 0; singleDetail && (iNode < sceneNodes.size()); iNode++) {
            domNode* node = sceneNodes[iNode];
            if (dStrStartsWith(_GetNameOrId(node), "base")) {
               for (int iChild = 0; iChild < node->getNode_array().getCount(); iChild++) {
                  domNode* child = node->getNode_array()[iChild];
                  if (dStrStartsWith(_GetNameOrId(child), "start")) {
                     singleDetail = false;
                     break;
                  }
               }
            }
//ME Addition to dae2dts multilod bipeds
			else if (dStrStartsWith(_GetNameOrId(node), "bip")) {
		        singleDetail = false;
                break;
            }

         }
         break;

Rebuild and everything is fine
#4
09/04/2011 (5:41 pm)
@Richard: Late reply to your problem sorry, but you can use TSShapeConstructor (see the Collada and Script reference docs for more details) to control how the collada importer handles detail levels.

This is what the Shape Editor is using under the hood when you select "Trailing Number" LOD in the import gui (you may have noticed it creates a .cs file in the same folder as the model...).