Game Development Community

DTS normal map problem

by Mark Pilkington · in Torque Game Engine Advanced · 11/16/2008 (9:44 am) · 6 replies

I have exported out a DTS shape and wrote the shader for the normal map and diffuse. Here is where the problem lies, the diffuse map works fine on the shape but the normal map isn't being rendered. To test my shader was working I applied the DTS shape's texture to a DIF object and dropped that into my mission and the Diffuse, Normal map and Spec map are applied fine.

So...why does the shader effects not get applied to my DTS shape? I can't seem to work it out.

My shader is as follows:
----------------------
new Material(office_desk)
{
baseTex[0] = "desk_d";
bumpTex[0] = "desk_bump";
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 8.0;
};
----------------------

I have no idea and any help would be much appreciated (again. . .the texture and it's other maps seem to work fine when applied to a dif object.

Cheers
M

#1
11/18/2008 (2:17 am)
Are you exporting from Maya? It's known that max2dts saves full texture name while exporting, it does not remove the ext from it.
Try something like:
new Material(office_desk)
{
   mapTo = "desk_d.png"; // full texture name (or jpg/dds- as your tex is)
   baseTex[0] = "desk_d";
   bumpTex[0] = "desk_bump";
   pixelSpecular[0] = true;
   specular[0] = "1.0 1.0 1.0 1.0";
   specularPower[0] = 8.0;
};
Other than that - i dunno what can cause this.
#2
11/18/2008 (4:56 am)
For the lofe of me I just can;t figure this out and never had this trouble with TSE.

I added the file extension to the mapTo and theres no difference.

www.blacktreeuk.net/download/desk_files.zip

Here are the files that I'm using, inside the zip is the OBJ model, its diffuse and normal map, the DTS shape and finally my material shader.

If anyone can point out what I'm fdoing wrong I would be most appreciative, I know iots something really small, I just don't know what.

Cheers for your help guys.
#3
11/18/2008 (5:22 am)
The materials.cs file contains error on line 7: you are missing semicolon at the end. Other than that - all seems to be correct and I can see normal in game (TGEA171).

edit: if there is an error in script it will fail loading script, so no material definition is loaded.
#4
11/18/2008 (5:51 am)
Ah I see, now that did fix it. I am seeing some strange results though with the normal maps on my models. I have tested the normal maps in Maya and also in a friends game engine and the model and maps look good. But I'm finding there are areas still on my model which don't seem to be receiving the normal map information.

www.blacktreeuk.net/download/bad_map.jpg
www.blacktreeuk.net/download/file_cabinate_local.png
You can see that on the nearest edge the normal map is clearly in affect but the face that has the draws isn't.
What could be the problem there? Any ideas?

----
I am also seeing this on the desk model too.
#5
11/18/2008 (6:00 am)
Normal maps are working when it receives light. the draws-side is on "shadowed" side. Turn around that box and you will see it working.
Usually it's a question of placing lights in mission so every object that needs it's attention will get it (from light).

Try placing a couple of sgLightObject objects with "lowLight" datablock around your model, and you will notice the "normal map" will work from every side.
#6
11/18/2008 (6:23 am)
Ah excellent....sorry I'm bad

Cheers for all your help bank I appreciate it alot.