Game Development Community

Missing Materials

by Jeremiah Fulbright · in Torque Game Engine Advanced · 07/02/2006 (7:35 pm) · 11 replies

With the Rendering changes, what needs to be fixed for DTS shapes to properly get their materials setup?

img140.imageshack.us/my.php?image=base000215505pm.png

That was showing the texture fine before MS 3.5/Rendering changes and we do have a Materials.cs file with it, but maybe its something with how the engine is finding or referencing textures now.

Not necessarily a bug, but it needs to be noted somewhere such as documentation of changes

#1
07/02/2006 (9:36 pm)
The only change I'm aware of is that all material definitions must be in a file called materials.cs, and it sounds as if you have that. Make sure this/these files (you can have more than one) are in your /data directory.
#2
07/02/2006 (11:41 pm)
There were not changes to how materials are assigned to textures. Before the "warning" material was added, it would draw the geometry using fixed function with ambient lighting. I suspect that's what is going on - you need to re-examine your material mapping for that model and make sure that it is correct.
#3
07/03/2006 (6:11 am)
Okay, I had knew that it previously drew the geometry via fixed function and sort-of "stacked" the shader side of it on (for lack of better words).

I know we have the materials.cs defines, but the only thing not there is a mapTo in it, because the material is the proper name. I will do some more digging though and see what its looking for

Thanks
#4
07/27/2006 (12:56 pm)
Having this same problem. Worked fine in a pre 3.5 version but not in MS3.5.

I've confirmed I have my image paths correct in the materials.cs file, so now I'm thinking that the material name I am using must not match my model's material name. Any hints on how to check a model (dts) and get it to tell you exactly what material name it's going to use?

Ah one other thing on this - if you run the starter.fps in MS3.5, the crossbow ammo clip and a few other items show up as missing. The crossbow itself shows up fine.
#5
07/27/2006 (1:27 pm)
I see this coming up from time to time around here.

Your models material name has nothing to do with how things run inside TSE.
To verify, edit an already working material and name it something stupid. It will still work. These names are there so you can reference the material later.

The exporter (AFAIK) never exports any material names from the scene. It does however export the texture's name, where bitmap.png would be bitmap.

And this is where the mapTo field comes into play.
#6
07/27/2006 (1:30 pm)
Yea had just figured it out. My original material file was...
new Material(CubixStudioMaleNPC)
{
   baseTex[0] = "~/data/shapes/CubixStudioMaleNPC/CubixStudioMaleNPC";
};

and I changed it to

new Material(cubixplayer)
{
   baseTex[0] = "~/data/shapes/CubixStudioMaleNPC/CubixStudioMaleNPC";
};

and all is well. I didn't realize that having the material and texture names the same would screw it up.

Would it be reasonable to have some kind of error/warning message when this happens? My initial effort was to search the logs for error messages.
#7
07/27/2006 (1:51 pm)
I suspect (usual caveat) this is not because your material has the same name as your baseTex, but because it has the same name as the map in your object, i.e. what you'd assign the mapTo.

I ran into something similar, and while I didn't dig deep into the code to prove the point, that was the conclusion I reached.
#8
07/31/2006 (12:54 pm)
There shouldn't 'technically' be a problem with naming the Material the same thing as the base texture. You do have to be careful that you don't have two materials with the same name however, or one will clobber the other and that may lead to the unmapped state. Since you can have multiple Materials with the same base texture, it probably wouldn't be a great idea to always name the material after it.
#9
08/07/2006 (5:38 pm)
Im suffering this same problem. Textures on a new player model worked until we switched from TGE to MS3.5. The space orc is fine, but our new models refuse to texture.
Ive created a new materials.cs for them based on the above info, to no avail. Ive used ShowToolPro to divine the correct texture names, and the textures display fine in STP.

Also tried changing the Material instance name to something else to avoid a namespace collision - no effect.

Is there any way to get TSE to show the name of the material it thinks it's looking for when the decision to apply the no_texture texture is made? Some code perusal revealed the NoTexture const, but even that is referenced all over the place to my surprise.

I just wish I knew what texture name the code thinks it's looking for, and where it thinks it's looking. Cuz it's either got the wrong name somehow, or the wrong location(s).

-Van
#10
08/08/2006 (12:13 pm)
Did you try putting a mapTo = yourTextureName; inside of the Materials definition? There seem to be cases where this is required, and for our guys, we've been recommending it be done, no matter what.

There are cases where a Materials object name will conflict with another Datablock of the same name in the game... such as

new Material(Ammo)
{
baseTex[0] = "~/data/shapes/AmmoBox/AmmoBox_Diffuse";
};

datablock ItemData(Ammo)
{
name = "Ammo";
};


In a majority of cases, the above two objects would conflict and cause missing textures or missing Item.
#11
08/10/2006 (11:24 am)
My partner Cory found the answer. Had to add the .JPG extension to the baseTex, even though convention states otherwise.

Maybe it's a bug in the Maya exporter. *shrug*. Our artist is shifting over to Max anyway.