T3D Not Using My materials.cs files!
by Nicolai Dutka · in Artist Corner · 04/23/2010 (12:32 pm) · 1 replies
I've got a weapon made up of 2 meshes and 5 textures.
Mesh 1: 1 diffuse, 1 normal, 1 spec
Mesh 2: 1 diffues, 1 normal
I've created a materials.cs file right next to the textures and mapped them to 2 different materials, one for each mesh on the gun. When I open the game, mesh 1 looks perfect, but mesh 2 has transparency on it. I never setup ANY transparency in Max OR the materials.cs file. It also looks like mesh 2 is having 'sort' issues, but if I add a 'sort::' to the mesh in Max, I get an error exporting (something about too many faces maybe?). Anyway, I don't understand how there could be any transparency at all if I never set up any... I triple checked all my Max settings and the textures themselves.
When I open up the console, I see warning for 'Missing Materials' which sadly, have the texture names I already created a materials.cs for!! Why would it not read in my materials.cs file, say I didn't make one, and then create one on its own?
When I spawn the object in the editor and click on it using the material editor, it is listing out 5 different materials (none of which were created by me). It seems to have created a separate material for each of my 5 textures. This is SOOOOOO WRONG!! It mapped my 'normal' texture to it's own material and put it in the diffuse slot!!
Here is MY materials.cs:
Mesh 1: 1 diffuse, 1 normal, 1 spec
Mesh 2: 1 diffues, 1 normal
I've created a materials.cs file right next to the textures and mapped them to 2 different materials, one for each mesh on the gun. When I open the game, mesh 1 looks perfect, but mesh 2 has transparency on it. I never setup ANY transparency in Max OR the materials.cs file. It also looks like mesh 2 is having 'sort' issues, but if I add a 'sort::' to the mesh in Max, I get an error exporting (something about too many faces maybe?). Anyway, I don't understand how there could be any transparency at all if I never set up any... I triple checked all my Max settings and the textures themselves.
When I open up the console, I see warning for 'Missing Materials' which sadly, have the texture names I already created a materials.cs for!! Why would it not read in my materials.cs file, say I didn't make one, and then create one on its own?
When I spawn the object in the editor and click on it using the material editor, it is listing out 5 different materials (none of which were created by me). It seems to have created a separate material for each of my 5 textures. This is SOOOOOO WRONG!! It mapped my 'normal' texture to it's own material and put it in the diffuse slot!!
Here is MY materials.cs:
singleton Material(LeftArm)
{
mapTo = "LeftArm";
diffuseMap[0] = "art/shapes/Objects/Weapons/LeftArm_Diffuse.png";
normalMap[0] = "art/shapes/Objects/Weapons/LeftArm_Normals.png";
translucentBlendOp = "None";
alphaRef = "0";
};
singleton Material(RayGun)
{
mapTo = "RayGun";
diffuseMap[0] = "art/shapes/Objects/Weapons/RayGun/RayGun_Diffuse.png";
normalMap[0] = "art/shapes/Objects/Weapons/RayGun/RayGun_Normals.png";
translucentBlendOp = "None";
alphaRef = "0";
};
Torque 3D Owner Nicolai Dutka
I fixed the entire mesh by changing my materials:
This works:
new Material(RayGun){ baseTex[0] = "./RayGun_Diffuse"; bumpTex[0] = "./RayGun_Normals"; };Now if someone could explain the difference so I know wtf I'm doing here, that would be wonderful! ;)