View Full Version : PP Lighting possible without normalization cube map?
03-09-2003, 02:18 PM
I've tried to do perpixel lighting by interpolating the tangent space light vector across the poly in col0, and normalizing in the register combiners.
But it just looks like goraud shading when the light is inside the perimeter of the triangle.
I get a proper circular highlight when using a cube map to get my interpolated vector.
It occurred to me that the normalizing cube map might be giving me 'spherical' interpolation...would this be true?
03-09-2003, 03:52 PM
"Normalization" keeps the length correct for your dot products not the vector direction, but that shouldn't be a big problem for you (it is an issue but a much more advanced one w.r.t. trading precision for interpolation accuracy). You should still see a peak inside the triangle.
Just remember that the light has to be very close to the surface (relatively speaking) to produce an effect where the center of the polygon has a significantly larger dot product than the vertices, or your normals have to diverge a fair bit. Lack of any attenuation will make it essential that you set up an extreme case before there's much noticeable difference.
set up a simple, but extreme case and compare vertex with fragment:
^ normal ^ normal
| * light |
This should produce a significant peak in brightness at the center of the polygon if you have normalized your light vector corectly and there are no surface normal interpolation/normalization issues (keep the normals vertical at first just as an initial test), it's a real simple case that should convince you that you are doing something right.
[This message has been edited by dorbie (edited 03-09-2003).]
03-11-2003, 12:23 PM
Food for thought, dorbie. Thanks.
I think I've messed up somewhere else in my code, then.
Thanks for at least telling me that it is indeed possible - I really was beginning to doubt it.
Back to a nice simple cube I suppose....
03-11-2003, 12:38 PM
If you don't want to do dependent reads (for bump mapping) but instead want plain diffuse+specular with vertex normals interpolated per pixel, then you can use NORMAL_MAP and REFLECTION_MAP texgen and use an appropriate texture matrix to collapse these texture coordinates into a 1D, 2D or cube map precomputed lighting solution.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.