Game Development Community

Mesh with 2 textures / materials

by Frank Geppert · in Game Design and Creative Issues · 04/08/2008 (2:09 am) · 3 replies

Dear friends,

I checked some models in TGEA and it works fine for models with one texuture / material.

But when I import a model with 2 of them then it works fine without shaders but if I add a bumpmap then the second texture becomes black.

I made a material with 2 stages (did not work at all) and I tried to make an extra material for the second texture (this made a mess for the second one overlaying 2 textures over each other while still being dark).

Did I make something wrong? I did not find a hint in the docu so far.

Regards,
Frank

#1
04/08/2008 (4:22 pm)
Have you made up a material.cs file for your textures? This sounds like a problem I was having for a while, but making a material.cs file fixed it. This is expecially true if you have transperancy in a texture.
I did a search of all the material.cs files in all of the examples to get an idea of what all I needed. They work. I have one object that has 6 different textures, and 1 overlapping transperant texture. They all work.
This is a pic of the inside of that dts
Edit: the center carpet is a transperant texture overlaying the base floor texture.
#2
04/10/2008 (1:24 pm)
Thanks Mike. I am happy that it works for you but I could not get it to work. I will tell you, what I did:

I made a new folder:
Forge Demo\scriptsAndAssets\data\shapes\machines

There I copied a few DTS models (machines) with PNG textures for diffuse (with alpha channel for spec) and normalmaps.
The PNG diffuse maps are called "turb2_c.png" and "turb2_c2.png"

Then I created file "materials.cs":

new Material(turb2_c)
{
   mapTo = "turb2_c";
   baseTex[0] = "turb2_c";
   bumpTex[0] = "turb2_n";
   pixelSpecular[0] = true;
   specular[0] = "0.55 0.5 0.5 0.4";
   specularPower[0] = 16.0;       
}

new Material(turb2_c2)
{
   mapTo = "turb2_c2";
   baseTex[0] = "turb2_c2";
   bumpTex[0] = "turb2_n2";
   pixelSpecular[0] = true;
   specular[0] = "0.55 0.5 0.5 0.4";
   specularPower[0] = 16.0;       

};

I also tried something like that but it did not work:

new Material(turb2_c)
{
   mapTo = "turb2_c";
   baseTex[0] = "turb2_c";
   bumpTex[0] = "turb2_n";
   pixelSpecular[0] = true;
   specular[0] = "0.55 0.5 0.5 0.4";
   specularPower[0] = 16.0;       
   // Stage for second texture of turb2_mesh
   mapTo = "turb2_c2";
   baseTex[1] = "turb2_c2";
   bumpTex[1] = "turb2_n2";
   pixelSpecular[1] = true;
   specular[1] = "0.55 0.5 0.5 0.4";
   specularPower[1] = 16.0;       

};
#3
08/20/2008 (4:55 pm)
Just wondering, if i have 2 textures where i want them to be one ontop of the other, how could i do that?