Game Development Community

No Material' on surfaces in TSE

by Sultan Ansari · in Torque Game Engine · 10/10/2006 (1:38 pm) · 5 replies

I'm converting a large project from TGE to TSE. In TGE I guess you didn't need to define a material for every texture. In TSE apparently you do? So now I am manually placing a 'materials.cs' file in every folder with textures and making an entry like this for every texture in the folder:

new Material(MATERIAL_NAME)
{
baseTex[0] = "~/data/shapes/shape_name/texture_name";
};

First of all, is there some easier way to do this? Like maybe some way to define a default material for every texture?

Second, I'm pretty sure I've defined materials for all my textures, yet I am still getting the "No Material" error texture on many surfaces in game. What can cause the "No Material" error besides not explcitly defining it in the Materials.cs file?

#1
10/10/2006 (3:23 pm)
For your first question, what I did was write a simple python script that went into a directory and created a materials.cs that included all of the textures in the directory as a separate material. I could probably write a resource that included the python script (although it does nothing in the way of error checking or special cases for the most part) if there was interest.

For your second question, I added a check to the engine that outputs what object it is assigning the No Material material to, and what Material it was looking for. It can result in lots of output to the console, but as a temporary debugging tool it is handy.

Whoops, didn't realize this was a non-TSE forum, so I removed the little bit of code that I had included.
#2
10/10/2006 (3:47 pm)
Quote:First of all, is there some easier way to do this?

Someone had posted a torque script resource a few months ago which would handle this, but I neglected to save the link. You might try that section.
#3
10/10/2006 (4:00 pm)
I created a forum post in the TSE section that had the code snippet that I had previously included above.
#4
10/12/2006 (6:39 am)
Thanks guys. BTW here is the script to auto map them:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=7091
#5
10/12/2006 (2:05 pm)
Oh and I figured out the problem. Some assets were created in Maya, so you need the file extension in the material declaration:

baseTex[0] = "texture_name.png";

whereas other assets were created in Max so you dont put the '.png'. So now its a trial and error affair figuring out which is the case. =(