View Full Version : My normal maps look like hell
I want to set the last texture unit to the normal map and blend it with the result of the previous texture units, in a way such that the normal map both lightens and darkens the texture.
I am trying to do it like this, but my normal maps come out almost full black. Every vertex in the color array is set to (196,196,255), just for testing, so I know the vertex colors aren't a problem:
08-15-2006, 03:14 PM
If you set the normal map to the last texture unit in the way you do, you are doing dot3 operation between normal map and color result from the previous texture units interpreted as vector. The resulting nonsense greyscale value is used as final color.
You need to set the normal map dot3 operation to the first unit and modulate its output with whatever the other texture units are doing.
I set the bumpmap up on texture unit 0, like this:
Like this, I can't see the bumpmap, even when I turn off all other texture units. I had tried several other variations, keeping the normal map on texture unit 0.
08-15-2006, 03:55 PM
You are setting incorrect value for GL_SOURCE0_RGB parameter. It should be GL_PRIMARY_COLOR or GL_PREVIOUS.
The GL_SRC_COLOR is one from possible values set to the GL_OPERAND0_RGB parameter it has no sense to set is as value to GL_SOURCE0_RGB parameter.
Well, I tried that and a lot of things, but I just get pure white.
Something's wrong....let me look at this some more...
08-15-2006, 04:13 PM
How your current setup for the enabled texture units looks like?
If you enable only the texture unit with the normal map and you set its texture environment mode to the GL_REPLACE, does the texture look correct?
If you disable all texture units, does the vertex color look correct?
Okay, I got it to work using this:
I found that I got the most correct lighting by setting the blue value to 192 (halfway between 128 and 255) and using a mod2x blend on the next texture unit using "glTexEnvf GL_TEXTURE_ENV,GL_RGB_SCALE,2.0". This made the normal map brighten and darken the texture.
Here's the final result:
Another shot. :)
08-16-2006, 08:34 PM
That looks cool for just using texture stages.
08-17-2006, 04:14 AM
I imagine they're highly tesselated.
08-17-2006, 02:22 PM
Looks like you got it, there was some dodgy advice given earlier, you need to do your DOT3 first then modulate. If you use crossbar it's slightly less of an issue but the point is you need to get your DOT3 result THEN do something with it like modulate another texture, taking anything other than meaningful vectors into a DOT3 will produce garbage.
Knackered, I just built the wall in a way so that a couple of vertices would lie under the spotlight:
08-17-2006, 08:40 PM
So are you using a cube-map with a "dot" on one side to do that spotlight?
Not sure what you mean. The lighting is a lightmap. The bumpmapping is done by calculating which lights affect each vertex.
08-21-2006, 01:45 AM
Ok, I though the spotlight was dynamic - AKA like those old Ron Frazier demos. (can't provide link as he has taken down his tutorials - was at http://www.ronfrazier.net/apparition/research/per_pixel_lighting.html and http://www.ronfrazier.net/apparition/research/advanced_per_pixel_lighting.html )
08-21-2006, 01:40 PM
Click on Research Projects on the left...
08-21-2006, 01:44 PM
It's a shame we have to access his page like this. Sure it's old, but still good IMHO.
It looks to me like he is just drawing on the cubemap to move lights around. This is like a dynamic lightmap, but even more limited, since it will only work on a box-shape room with the camera in the center.
08-21-2006, 02:13 PM
His room isn't a box.
08-21-2006, 04:30 PM
The tutorials are still up on his website, but the old links don't work.
then go to research projects
08-21-2006, 05:36 PM
Hmmmm...it's interesting in that I could have sworn I tried that and got an error. Maybe I had a typo and didn't realize it.
Anyway, that's great news! :)
08-21-2006, 08:40 PM
Humm, it seems that either something is funky my end or the website is broken but when I use firefox "Open in new tab" on the links off the research page, the page is not found(404). If I just click on the links, they work.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.