Game Development Community

Blender dts exporter materials.cs

by Los Pistoles · in Torque Game Engine Advanced · 04/14/2009 (4:14 pm) · 10 replies

I've toggled the Write TGEA materials button both ways and played with tons of settings, but no matter what I do, it won't look at the materials.cs file materials information. I've completely deleted the materials.cs file, with no effect on the model. It looks exactly the same in Show Tools and in game.

I'm sure that I'm just missing a simple setting somewhere, but I feel like I've played with all of them. I've been over the documentation and googled around a lot with no results :(

Thanks in advance

#1
04/14/2009 (4:21 pm)
You do have to have your "materials.cs" in the same folder as your material(texture) file.

Of course that means lots of textures in the same folder, so you need to copy and paste all your material info into one material.cs file for all the textures in that folder/directory.

You don't need all of the export settings for materials (translucent, nroormal map, glow, spec, etc) - it doesn't affect the DTS model, only the file info does.
Personally, I would not bother with Blender's material file and make your own manually. Just type it in and save it.
#2
04/14/2009 (4:32 pm)
Thanks for the reply,

Yeah, I figured it didn't change the materials inside the DTS, i just thought maybe it told it to look for the materials.cs file. I had always planned on writing my own materials.cs file.

The weird thing is that the texture shows up fine, regardless of the materials.cs file being there (in the same dir as the DTS) or not.

This would be fine, but I can't do effects (bumpMap, reflect, etc)
#3
04/14/2009 (4:38 pm)
The texture will show up fine, the DTS get's told to use it on export (in the materials section). You need your materials.cs to point to the texture file.

e.g.
new Material(darkmetal1)
{
mapTo = "darkmetal1";
basetex[0] = "darkmetal1";
bumptex[0] = "lightspec_nm";

pixelSpecular[0] = true;
specular[0] = "0.7 0.7 0.7 1.0";
specularPower[0] = 16.0;
};

I just use texture name as material name - KISS - Keep It Simple (Stoopid)
Read through the docs section on materials which comes with the TGEA download for indepth explanations on how it all works.
#4
04/14/2009 (4:47 pm)
So there's no way to change the skin image once you export? I have placed the materials.cs file in the same directory as the DTS and the textures (.jpg format)

this is my materials.cs file

new Material(tex)
{
mapTo="tex";
baseTex[0] = "./tex";
};

I've tried changing it to

new Material(tex)
{
mapTo="tex";
baseTex[0] = "./tex2";
};

tex2 is a different jpg in the same directory, this doesn't change anything.

Also, shouldn't it error if there's no materials.cs file? or show that orange texture?
#5
04/14/2009 (4:53 pm)
It'll only show the orange texture if there is no texture to show.

Read the info in the docs on materials to explain why having mapto and basetex will only display mapto.
#6
04/14/2009 (4:58 pm)
Thanks for your help, and I will go over the documentation better, but I feel like this is a different problem.

None of the other functions seem to be doing anything either, I've changed the bumpMap, and several other options as well, with no change in showTools or tgea


And how would it know which jpg file to point to without a materials.cs?
#7
04/14/2009 (5:22 pm)
It is definitely storing the jpg texture file in the DTS, I moved the jpg and it continued rendering the model textured

EDIT: It somehow loaded the jpg from up one dir, after I deleted it, it showed the orange noMaterial texture
#8
04/14/2009 (11:32 pm)
It is normal that TGEA searches for files in upward direction. So you can reuse your ressources...
#9
04/15/2009 (8:00 am)
Yeah, I understand that now, sorry if I seemed short. I've just been beating my head against this thing for way too long. I'll sit back and re-read all the documentation.

Hopefully after I understand this better I can do a write up on it.

Thanks for all your help.
#10
04/15/2009 (10:22 am)
I've read and re-read nearly every piece of documentation on the TGEA materials system and the blender DTS exporter, but still the only way i've been able to change ANYTHING on the model is via the exporter.

If I toggle on the exporter's Self-Illuminating setting, it works, the DTS is self illuminated in show tools and TGEA. The exporter also adds this to the materials.cs file (emissive[0]=true), however when I either remove this line or set it to false, it still remains self illuminated. As far as I can tell, this means that the instructions to illuminate itself are indeed stored inside the DTS.

Is this correct? Everything I've read points to all of the materials information being stored in the materials.cs file (in TGEA anyway). If it is indeed storing information inside the DTS, is there any way for me to tell the exporter not to? Or tell it to look for a materials.cs file as well?

EDIT: sorry, probably should have posted this in the first post: I'm using blender 2.48a and DTS exporter v 0.97 Beta 3