Specular lighting (again)

Hi all! As I wrote yesterday I’m trying to write a perfect replacement for a fixed function point light in a vertex program. Everything except specular now works (I think…). The specular look’s quite ok but if you compare with the ff version some artifacts are easily spotted. The highlights seems less sharp in some places, sharper in others. They’re also positioned slightly wrong… Some pics: http://www.itstudents.ch/users/dave/files/ffspecb.jpg http://www.itstudents.ch/users/dave/files/vpspecb.jpg http://www.itstudents.ch/users/dave/files/ffspec.jpg http://www.itstudents.ch/users/dave/files/vpspec.jpg

(I borrowed your site dave, thnx)

[Edit] - Better pics: http://www.itstudents.ch/users/dave/files/ffspecc.jpg http://www.itstudents.ch/users/dave/files/vpspecc.jpg

[This message has been edited by dbugger (edited 07-10-2003).]

Do you have the same eye vector calculation in both cases, the Eye is a plane or a point difference seems to fit here.

Judgin by the looks if the last two images it seems like the fixed pipline uses the eye is a point calculation, and the VP uses the eye as a plane.

try glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER ,0); ( and another test with 1 instead).

Well I’ve already tried that, it made no difference . Thanks anyways for the reply.

It shouldnt make any difference in your VP path, but in the Fixed one…

[add]
How do you compute the eye-vertex vector in the VP?

[This message has been edited by Mazy (edited 07-10-2003).]

I tried to set the viewvector to {0.0,0.0,1.0,0.0} and localviewer to false. Everything looked fine. The spec say: For local lights or a local viewer, h_inf is well-defined but does not match the normalized half-angle vector, which will vary depending on the vertex position.

Now I use (normal dot viewvec), isn’t that correct?
The viewvec is camerapos - vertexpos normalized…
I’ve probably done something stupid…

[This message has been edited by dbugger (edited 07-10-2003).]

hehe, just use my space, thats what its there for…