Game Development Community

[Bug] Adding textures to imported DTS and Collada files from Blender

by John Bura · in Torque 3D Professional · 10/01/2009 (10:43 am) · 12 replies

So I had this idea to model simple objects in Blender then import and texture/normal/detail in torque. However every time I do this the program crashes.

Im not sure if Im doing something wrong. But I just expected the texture to appear on the object.

If Im doing something wrong let me know. :)

#1
10/01/2009 (10:53 am)
Hey John, I've been using Blender to make my models (using Collada, not DTS) and haven't had any crashes.

What exactly is your process, right now? Are you applying texture coordinates to the model in Blender? Are you giving the models unique material names?
#2
10/01/2009 (11:11 am)
Im not applying any material or textures in Blender.

In the material Editor I

Add new material

It asks me if I want to save changes to the material. If I push yes or no, the program crashes.
#3
10/01/2009 (11:17 am)
@Gary
Have you managed to get a successful LOD/Collision exporting with Collada?

@John
Yeah, texture coordinates and materials. Technically you don't really need to set materials up as DTS reads the UVinfo, but you should cos it's good practise.

My only thought is that it could be having problems making a new materials.cs file ... though I am basing this on wild guesswork.

Export your DTS as usual, make sure there is a materials.cs file listing your textures in the same directory as your textures, then open up the Material Editor with the DTS pre-selected and select the diffuse textures, etc.

==============================================

EDIT: You need to have a UV sorted in Blender and at least a single material (default material fine, even default UV fine but you need them) or it's got nowhere to put the material in-game.
#4
10/01/2009 (11:24 am)
@Steve
Yep... I posted a tutorial on it on my site (http://www.biomassthegame.com/j20090721.html). Although it's a little out of date since with 1.0 all of your collision mesh names have to start with the word "Collision". So, I need to update it.

@John
Yeah, you have to have a material in Blender because that is what T3D maps to when it creates its material. If you have no Blender materials, there's nothing to map to.
#5
10/01/2009 (11:26 am)
Awesome, thanks for the advice guys!

@ Gary, Biomass the game is a really awesome name!
#6
10/01/2009 (11:45 am)
@Gary
Cheers for the link, I'll have a play later and see if I can get it all to work.

I had been having a chat with pureLight's head programmer and he was perplexed as to why Blender's dae exporter kept throwing nodes all over the place.
#7
10/01/2009 (1:13 pm)
@Gary
In regard to the "Collision" thing there is a code change to fix that in:
http://www.garagegames.com/community/forums/viewthread/102597

Makes it work with Col and Collision, probably easier than remaking assets.
#8
10/01/2009 (1:18 pm)
Thanks Brett!

When I update the tutorial definately include both options.

Since I'd never used DTS or the structure before, I didn't including any naming convention for collision meshes in my tutorial (the collada importer of the time didn't need any and I figured out the structure by looking at the loader).

It seems like I missed that when I started learning it and it just worked by coincidence :)
#9
10/01/2009 (3:26 pm)
Quote:It seems like I missed that when I started learning it and it just worked by coincidence
Same with DTS not needing materials sorting correctly, as long as there is a single material the format reads the differing UVmaps fine - same appears to go for Collada (tested as importing into pureLight).
#10
10/01/2009 (6:02 pm)
@Gary
I owe you a beer and my sanity!

One little issue with your updated tutorial:
CollisionLEngB-1 needs to be LEngBCollision-1

And if you select "Use UVs Image" to override materials in the exporter it sticks all your textures on for you.

farm4.static.flickr.com/3262/3972904908_781d062598_o.png
--------------

One thing I did notice is that the cached.DTS is 3 times bigger than a standard Blender exported DTS of the same object.

Thanks for that, a grave mystery of the universe is solved, and Collada finally works accordingly from Blender.
#11
10/01/2009 (6:21 pm)
@Steve

Interesting, because putting "Collision" at the front of the name (CollisionLEngB-1) worked for me, and looks like what you did in your example as well (Collisiona-1, not aCollision-1).

BTW, I did that based upon the loading code that did:

const char* detailName = "detail";
         if (dStrStartsWith(meshNames[iMesh], "Collision"))
            detailName = "Collision";
         else if (dStrStartsWith(meshNames[iMesh], "LOSCol"))
            detailName = "LOS";

Which looks like it's expecting it to start with the word Collision.
#12
10/01/2009 (6:29 pm)
Hmm, yeah thats odd; "string starts with meshname, collision", I tried that and no dice, no collision. Works fine the other way-round.