views:

176

answers:

1

I'm using texture-based DOT3 lighting to achieve bump mapping on older iPhones, and I'm wondering if there's a sneaky way to make it look correct even when the viewpoint changes.

With "real" lighting, normals get transformed by the inverse model-view matrix. With texture-based DOT3 lighting, there's no transform.

With shader-based bump mapping, the normal map is in tangent space. With DOT3 lighting, the normal map needs to be in eye space. This is okay only if you have a fixed viewpoint, or if your geometry happens to be a flat plane.

Should I just accept this as another limitation of DOT3 lighting? Since it can't handle specular either, I'm starting to question how useful it really is.

+5  A: 

Your normal map isn’t required to be in any particular space, as long as the light vector is in the same coordinate space. For DOT3 lighting on fixed-function hardware, it’s probably best to keep a normal map in object space, rather than eye space. From here, you just need to make sure that when you render each object, you apply the appropriate transformation to move your directional light vector from world space to object space.

Pivot
Thanks! I was hung up on doing my lighting in eye space, but you're correct; since my model-view matrix happens to be orthogonal, I can perform lighting in object space, thus freeing myself to move the camera and object.
prideout