View Full Version : Specular lighting (again)

07-09-2003, 11:36 PM
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).]

07-09-2003, 11:51 PM
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).

07-10-2003, 12:00 AM
Well I've already tried that, it made no difference http://www.opengl.org/discussion_boards/ubb/frown.gif. Thanks anyways for the reply.

07-10-2003, 12:04 AM
It shouldnt make any difference in your VP path, but in the Fixed one..

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

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

07-10-2003, 01:48 AM
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... http://www.opengl.org/discussion_boards/ubb/smile.gif

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

07-10-2003, 01:50 AM
hehe, just use my space, thats what its there for.. http://www.opengl.org/discussion_boards/ubb/biggrin.gif