View Full Version : Cube maps for normalization
02-26-2004, 08:43 AM
I am using pixel shaders to do per-pixel-lighting.For renormalization purposes(both the normals and the light-to-vertex vectors) i am using cube mapping.Everything seems fine,but when i am using some spot exponent(that is,raise the dot product of normal and light vector to some power) the lighting is not smooth:I see some strange pixeled rings on any surface that is lit.The problem disappears if i renormalize using mathematical instructions,but that's too slow.I am using linear filtering in the cube maps.Also,I tried to increase the resolution of the cube maps to 1024x1024 and the precision in the components(using GL_RGB16).The visual result is improved,but the artifacts are still very obvious.
How exactly do you raise the dot-product to some power?
Register Combiners? Those give extremely bad results for specular lighting.
Tell us more about your method, your hardware etc. this is not enough information to tell where the problem is.
02-26-2004, 06:46 PM
By "pixel shaders" I assume ARB_fragment_program or NV_fragment_program.
You may be seeing an "optimization" where the driver decides to go to fixed point resolution for speed, and this optimization might go away when you actually use RSQ.
It's possible to normalize a normal that's "close to good enough" by using a Taylor approximation to the function you want.
You could either just use that, or you could first read out the cube map, and then normalize that value using the simplified math.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.