Specular on GF4Ti


I’ve been trying to get correct specular going and it doesn’t seem to be quite right. I have a normal cube map for the vertex to eye and vertex to light vectors, which i sum in the combiners and then normalize using the RC normalize trick to produce the H vector. Only problem is it doesn’t seem to work :-), and I would rather not tesselate the polygons

I use GL_HALF_BIAS_NORMAL_NV to expand the values from the two cube maps.

Should what I’m trying work? Or is there some better trick with the texture shaders?

I sometimes get two specular highlights on a polygon, one in ore or less the right place and one kind of under the light.

Well thanks for any suggestions, I’m sure nVidias current best GPU can do correct specular lighting, so it must be me :-p.


  • Richard

Are you sure you don’t have another dot product going on somewhere in a combiner from a previous calculation? It seems impossible to get two dot product peaks on a single primitive without it.

What do your tangent space vectors look like? maybe if your vertex coordinate frames were totally whacked this could happen with signed vectors looping over huge angles during the interpolation and you covering both half spaces to give you two peaks in the dot product on a single primitive.

It seems more likely you just have two DOT3s going on though.

Originally posted by FatalXC:
I use GL_HALF_BIAS_NORMAL_NV to expand the values from the two cube maps.

You should rather use GL_EXPAND_NORMAL_NV because it expands to [-1,1] range. GL_HALF_BIAS_NORMAL expands to [-0.5, 0.5] so your specular is multiplied by 0.25 after dot product. The highlight is probably too dark to see, especially if you raise the dot product to some power.