Game Development Community

Normal Map Issue?

by James Spellman · in Torque Game Engine Advanced · 10/25/2007 (11:13 am) · 0 replies

I think this is a bug so I'll state my case here and see what you all decide.

I was experimenting with Normal Maps and everything was peachy until I got to the heads of my toons.

Here, hopefully, is the before pic:

www.thestarbug.com/images/offsite/NoNormalMap.jpg
and here it is with my Normal Map:

www.thestarbug.com/images/offsite/BadNormalMap.jpg
The Normal Map itself didn't really make a difference. I was always getting those "hotspots". There was nothing obviously wrong with the Mesh. By messing around with the model, I was able to get the spots to change shape but never go away. That's when I started poking around in the engine.

Without knowing what I was doing, I started debugging the problem by changing settings, turning things on and off before I finally found the code in bump.cpp that affected my image.

The line around 336 read:

meta->addStatement(new GenOp("   @ = saturate( dot(@.xyz * 2.0 - 1.0, normalize(@.xyz)) * @.w );\r\n",
 bumpDotDecl, bumpNorm, lightVec));

the problem, to me, was that normalizing the bumpNorm was artificially inflating the lighting in those key areas. By removing the normalize to look like:

meta->addStatement(new GenOp("   @ = saturate( dot(@.xyz * 2.0 - 1.0, @.xyz) * @.w );\r\n",
 bumpDotDecl, bumpNorm, lightVec));

my result is now this:

www.thestarbug.com/images/offsite/NoNormalize.jpg
I also changed the following Shader 1.x line to not use normalize.

So now am I insane? Does my artist need to fix something in the model? Let the debate begin...

Edit: Worked out the image paths, formatting