Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Specular lighting (again)

  1. #1
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Jönköping, Sweden
    Posts
    86

    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).]

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: Specular lighting (again)

    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).

  3. #3
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Jönköping, Sweden
    Posts
    86

    Re: Specular lighting (again)

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

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Oct 2001
    Posts
    612

    Re: Specular lighting (again)

    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).]

  5. #5
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Jönköping, Sweden
    Posts
    86

    Re: Specular lighting (again)

    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).]

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Feb 2001
    Location
    Switzerland
    Posts
    1,840

    Re: Specular lighting (again)

    hehe, just use my space, thats what its there for..
    http://davepermen.net - if i could stay true to my heart, i would feel totally free

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •