PDA

View Full Version : PPL and geometry normals

V-man
03-25-2003, 07:57 PM
When doing PPL, do I need to take geometry normals (vertex normals) into consideration in any way?

The lighting is done in tangent space and vertex normals is used in the construction of the orthonomal basis, but when doing the dot3 lighting, should the vertex normals be interpolated across the polygon and "perturbed" by the normal map.

Banzai
03-25-2003, 11:49 PM
Originally posted by V-man:
When doing PPL, do I need to take geometry normals (vertex normals) into consideration in any way?

The lighting is done in tangent space and vertex normals is used in the construction of the orthonomal basis, but when doing the dot3 lighting, should the vertex normals be interpolated across the polygon and "perturbed" by the normal map.

Yes, the vertex normals are interpolated
together with the tangents and binormals.
If you interpolate tangents and binormals
only your lighting equation will become
incorrect.

jwatte
03-26-2003, 07:01 PM
The actual normal you use is only the data that comes out of the normal map (possibly transformed by the inverse of the tangent basis into object space). Only "fake" du/dv "bump mapping" would use the interpolated normal and perturb it.

Note that you can do per-pixel lighting, using the regular interpolated (and normalized) normal, and no normal map; per-pixel lighting "only" means that the light equation is evaluated per pixel, given vectors that are interpolated per-vertex.

V-man
03-28-2003, 08:15 AM
Well we have 2 people saying different things so I guess some people have other methods.

Banzai, how do you do the interpolation of the orthonormal basis? Are you using fp for this?

JustHanging
03-28-2003, 08:24 AM
You use the normal, tangent and binormal at each vertex to transform the light vector into tangent space, and then you interpolate the light vector across the polygon. Right? I'm no expert here, I must say.

-Ilkka

V-man
03-28-2003, 09:04 AM
Yes, that's the basic idea.

diffuse = light vector DOT normal is done at each pixel that way.

The only real problem is the ^shininess thing for specular. If I want to do shininess=100 for example, ... deep deep trouble!

pow function required.

JustHanging
03-28-2003, 09:53 AM
Yeah. I guess what people usually do is approximate some fixed exponent with some other formula that can be calculated in the combiners. I think they can crank it up to 32 or maybe 64. Preferably you'd have of course several different exponents to choose from for different materials. Of course if you can use dependent reads, you can just make a lookup.

-Ilkka