# PPL and geometry normals

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.

Originally posted by V-man:
[b]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.[/b]

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.

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.

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?

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

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.

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