开发者

limitations of GL_DOT3_RGB

开发者 https://www.devze.com 2022-12-17 07:59 出处:网络
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.

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 norma开发者_如何学JAVAl 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号