Game Development Community

Help - Normal mapped textures not recieving shadows

by Jacob Neville · in Artist Corner · 11/30/2009 (11:45 am) · 6 replies

-This is in Torque3D-

Hopefully someone can help me with this: Trying to edit some materials for an interior I created, but when I add a normal map to the material dynamic shadows no longer show on it, instead just blocking out the specular in the region.

Without normal map:
www.supersmiley.net/images/temp/without_normalmap.jpg
With the normal map:
www.supersmiley.net/images/temp/with_normalmap.jpg
and the code for the material:
new Material(FLOOR3)
{
   mapTo = "FLOOR3";
   diffuseMap[0] = "scripts/server/interiors/FLOOR3.jpg";
	normalMap[0] = "scripts/server/interiors/FLOOR3_NRM.jpg";
	specularMap[0] = "scripts/server/interiors/FLOOR3_SPEC.jpg";
	pixelSpecular[0] = true;
	specular[0] = "1 1 1 1";
	specularPower[0] = 16.0;
   castShadows = "0";
};

Anyone see what I'm doing wrong? It's probably something basic and stupid, but I haven't worked with materials much yet.

#1
11/30/2009 (11:54 am)
Don't have "pixel specular" and "specular maps" together. They are different types of spec and fight each other. If you have a spec map, uncheck specular in the Material Editor.

Also if you have a spec map, you should be using a _nm which is DXT5_NM specific. It "might" cause issues if you've just got a "standard" normal map (but I'm on my first cuppa tea of the day so can't quite remember).
#2
11/30/2009 (12:38 pm)
Do interiors even accept normal maps?
#3
11/30/2009 (2:18 pm)
Yeah you can override the default materials in an interior in a regular materials.cs file, and they can accept normal maps.

Unfortunately messing around with the specular settings hasn't fixed the issue of shadows not showing up. Even without any specular at all the shadows still don't show properly.

Putting the same textures and settings on a DTS object works properly and shadows show up, so this seems to be just a problem with the material on an interior.

I have to admit I have no idea what a DXT5_NM is. This normal map was created using CrazyBump, if that helps.


Edit: Another issue has shown up. If the interior material has a normal map, it does not properly reflect the color of nearby lights. This occurs even if the normal map is the only other setting changed.

www.supersmiley.net/images/temp/redlight.jpg
I don't know, perhaps the render code for interiors isn't updated to use normal maps, but I don't know enough C++ to try to change that.
#4
11/30/2009 (3:04 pm)
DTX5_NM is a dds compression specifically designed to "twizzle" (it's a technical term - honest!) the channels of the texture and so not mangle it when compressing (which would cause artifacts). This is what a seperate spec map works with. Spec maps can be coloured.

Standard pixel_specular works off a set colour, and reflects that colour rather than the colour of the light. The specular channel should be the alpha of the normal map, and thus has to be greyscale.
#5
11/30/2009 (4:06 pm)
hmm shouldn't the alpha of the normal map be the displacement map, for parallax mapping?

Is all this documented somewhere? I'm getting confused.

Btw, I tested adding ordinary normalmaps on some difs I added to a map, and the shadows disappeared there also. So I don't think it's anything with your setup Jacob.
#6
11/30/2009 (4:41 pm)
@Janr
1. That's why you'd need a separate spec map image.

The thread about it

YouTube video linky

2. I guess it's a DIF issue then. I believe that they are being phased out next year. Hence the "export interior to collada" option under file menu.