Game Development Community

How to bake in dts changes ? [resolved, was bad DTS export]

by Jeff Yaskus · in Torque 3D Professional · 11/30/2011 (2:44 pm) · 10 replies

I'm trying to "bake in" the changes I do when a DTS model is loaded ... specifically, adding mount0 and mount1 nodes to the model.

However, all the methods I've tried either (a) dont work or (b) causes the engine to crash. (T3D 1.2)

I've tried to load the model as normal, then save the new shape using ...

%obj.saveShape("./baked_model.dts");

and this causes the engine to crash, sometimes the file gets generated ... but its not complete.

The other method I found in the new documents for T3D 1.2 ... suggest using dae2dts.exe will also load the model, applying changes you have in your model.cs file ... and save the new DTS with all the changes in it.

Of course,thats only for DAE models ... so I tried it with the models source DAE file and it generates the new DTS model correctly, but NONE of the changes are "baked into it".

... so HOW DO I BAKE CHANGES INTO A DTS MODEL??!

Can these mount points be added manually through Milkshape ? I use U3D to convert them ... but I've no art skills....

[EDIT:RESOLVED] Problem was due to a badly exported DTS Model from supplier ... manually imported the COLLADA source model and got it all working.

#1
11/30/2011 (4:20 pm)
Do this from the TSShapeConstructor script with the asset in it's folder. Within the onLoad, Jeff. This also works out of box!

See this Thread; Thread about saveShape
#2
12/01/2011 (9:20 am)
Thanks Rex - I am using T3D 1.2 both FPS Tutorial (compiled debug exe) and FPS Example (stock release exe). And trying to add nodes to (2) new models -- both cause the engine to crash when attempting to do so.

Most recently, tried with a compile debug exe and it generated a bit more details ... specifically this CPP error, in the console.log;
Executing art/datablocks/actors/ninja.cs.
Executing art/shapes/actors/ninja/ninja.cs.
baking ninja
t:torquetorque_3d_1.2enginesourcegfxutiltrilistopt.cpp(124) : Fatal - Ran out of 'nextBestTriangle' before I ran out of indices...not good.
Error, a DecalManager (2327aa8) isn't properly out of the bins!


And here is my entire constructor for the shape;
singleton TSShapeConstructor(NinjaDts)
{
	baseShape  = "./ninja.dts";
};

function NinjaDts::onLoad(%this)
{
   // basic anims //
   %this.addSequence("./ninja_idle.dsq", "root", "0", "-1", "1", "0");
   %this.addSequence("./ninja_walk.dsq", "walk", "0", "-1", "1", "0");
   %this.addSequence("./ninja_run_attack.dsq", "run", "0", "-", "1", "0");   
   %this.addSequence("./ninja_sneak.dsq", "crouch", "0", "-1", "1", "0");
   %this.addSequence("./ninja_dead.dsq", "death1", "0", "-1", "1", "0");
   %this.addSequence("./ninja_jump.dsq", "jump", "0", "-", "1", "0");   
   // Mount nodes //
   %this.addNode("mount0", "Bip_R_Hand", "0.104227 0.0191064 1.17136 -0.0018384 0.265279 0.96417 3.67292", "1");
   %this.addNode("eye", "Bip_Spine", "0.028035 -0.030355 1.93852 0.0684762 -0.991649 -0.109284 1.66383", "1");
   %this.addNode("cam", "Bip_Spine", "0.028 -0.03 1.94 0.068 -0.99 -0.11 1.66", "1");  
   // save shape
   echo("baking ninja");
   %this.saveShape("./ninja_baked.dts");   
}

So its "trying" to bake the changes in ... but something with the model is causing the crash.

NOTE: all of those changes were first done via the in-game model editor. the model appears to load fine into the game and the new nodes are applied "in memory" to the model.
#3
12/01/2011 (10:07 am)
Wow, really strange...

I just tried something similar to your above code on the stock 'soldier' asset, and it worked...go figure? I try stuf first on provided assets to determine if it's even doable...

It may well be with your art, the actual geomtery/vertices?!? I added a saveShape calling at the end of the "solder_rigged.cs" and it worked, even with loading and editing all those sequences!!!. I added a addNode calling above that and it worked as well; no crashing. I did this in the same SDK Example/FPS Example of 1.2 pro as you did.

At this point the observation is that perhaps the geometry in the ninja.dts file is doing something strange...to the process?!!

Can you send me a copy of the asset? So I could try some mumboJumbo here? Drives me to fist shaking when I don't see something working that I should!!!
#4
12/01/2011 (10:21 am)
I believe the nodes are just "dummy" objects linked to the rig, but I know you can add them in your 3D software. Perhaps you could simply add "bones" or whatever Milkshape calls them with no vertex weights assigned so that they don't deform your mesh and name them appropriately.

I'll double-check with the art guys in case someone else doesn't beat me to it.
#5
12/01/2011 (10:25 am)
Adding nodes after the fact in Milkshape is Verboten, Richard! You will destroy any animation and the rest of the rig by doing so!!

Lest you are a good buddy of Rex...hee-hee- who will edit and hand back your Ms3d file, 'gameReady!!'
#6
12/01/2011 (10:51 am)
Rex@ just sent you an email at your bag address.
#7
12/01/2011 (11:27 am)
Let me ask, was the supplied DTS binary, exported thru U3D? If not, let me know how the DTS binary was generated. I may have spotted the issue with 'baking' and with your 'setMeshHidden', all at once!

NB: and btw, I'm on MSNmessenger and Skype for realTime communication to ease up on the site...and it's more fun to voice chat anyways. I got's video too, game on!

my verdict: ya got's not Detail nodes in yer shape, no wonder it ain't responding to anything!!
#8
12/01/2011 (11:39 am)
See? This is actually a whole collection of issues that I'm supposed to get around to addressing before too terribly long - the need for a nice, clean step-by-step on setting up a character for T3D. I'm working on it, but I have plenty of other items to clean up first.

By Grapthar's Hammer, you shall be avenged!
#9
12/01/2011 (12:19 pm)
great, so is it possible to add details (LOD?) with the ingame object editor ?
#10
12/01/2011 (10:07 pm)
[resolved] issue was due to the model being improperly formated when exported. Luckily, I found the source for the DTS model in COLLADA format - re-imported it manually, made the necessary changes and the re-exported to new DTS model using saveShape.

I'm starting to like those DAE COLLADA shapes ... as I found out its just a XML formatted text file. You can open it up and edit directly, used it to clean up the default texture names in the DAE file before importing.