sjmarsha@Posted: Fri Oct 26, 2007 10:02 pm :
Hi All

I am attempting to write an engine, which loads the materials files, and then extracts the texture stages and create a nice effect in my engine.

I just don't know how to find the actual textures using the .mtr files.

Say : textures/glass/glass1_nvp

This is clearly a material name, as no 'glass_nvp' exists in the texture directory.

But how do I find the material file, which this belongs too.

I would need to search the how materials directory, and search each file, till I found it, but this seems very inefficient way to do things.

any ideas on how I can fine the correct .mtr file?

regards
Steve



rich_is_bored@Posted: Sat Oct 27, 2007 6:38 am :
First off, you need a bit of help understanding the structure of a material shader. Here's some good reading for you...

viewtopic.php?t=6617
http://www.modwiki.net/wiki/Material_%28decl%29

It's imperative that you understand that the names of material shaders do not correspond with directories. The entire string is the name. The forward slash delimiter used in material shader names is just a means to categorize via the material browser in the level editor.

That said, the easiest way to find a material shader is to treat all the *.mtr files like one big ass text file. There is some indication that effort was made on the part of developers to organize shaders into files but in the end, it didn't work. It's a mess.



sjmarsha@Posted: Sat Oct 27, 2007 7:19 am :
rich_is_bored wrote:
First off, you need a bit of help understanding the structure of a material shader. Here's some good reading for you...

viewtopic.php?t=6617
http://www.modwiki.net/wiki/Material_%28decl%29

It's imperative that you understand that the names of material shaders do not correspond with directories. The entire string is the name. The forward slash delimiter used in material shader names is just a means to categorize via the material browser in the level editor.

That said, the easiest way to find a material shader is to treat all the *.mtr files like one big ass text file. There is some indication that effort was made on the part of developers to organize shaders into files but in the end, it didn't work. It's a mess.


Hi There

So your saying there is no easy way to find the material definition, aside from search through each file.
I have looked over the documents you gave me.

regards
Steve



rich_is_bored@Posted: Sat Oct 27, 2007 9:10 am :
In the case of writing your own program to search for material shaders, there is no easy means to limit your search to the one *.mtr file with a match. You have to look at them all to find a match.

Keep in mind that you're the one writing a program here though. There's no reason you couldn't work this information out, save it to a file, and reference it later.