Updated the original with the new demo. Looks much better now.
Yes!!! The new one’s REALLY awesome! The sense of depth is incredible!
EDIT: IT MAKES ME DROOL. Shit.
EDIT2: Do you mind telling me how you solved it? I assume the problem was the way the normals were packed in the image? How did you unpack it correctly?
Thanks!
Regarding the “Y-invert” – it seems some programs export normal maps with inverted green channels and others don’t. For the sake of the example here I’m just sending a simple boolean to the shader (if true => invert green before calculating anything), but presumably in your own engine you will know whether or not the green channel needs to be inverted.
I have tested a bunch of normal maps I’ve found online (like these) and it seems like some need the green channel inverted, while others don’t.
right handed vs. left handed.
Ah. That makes sense.
It’s definitely better to invert the green channel (if necessary) when the texture is loaded. Branching and doing a little math per pixel is pretty stupid when you can preprocess it, no offense. =S
Probably most of these normal map were just auto-generated using a sobel filter…so you could drop the overhead of storage and just generate them at load time…then they’d all be consistent. Surely gimp has a plugin if you don’t want to go that route. A websearch of sobel and normal should give a fair number of hits. (Actually some edge detection in addition would probably be a good thing).