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 3 of 3

Thread: Specular wrong

  1. #1
    Advanced Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Specular wrong

    I have written small demo app to demonstrate differences between fixed function pipe and fragment shaders
    Demo
    But it seems that specular component is wrong. Or maybe ffp isn't clamping negative values
    Switching ffp/fsh: F1,F2
    Increase/decrease tessalation: PgUp,PgDown

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,453

    Re: Specular wrong

    Didn't look at it, I don't use rar, but is it that same as in the beginners forum topic which mysteriously vanished while I was posting a reply?

    I noticed that the half angle vector was wrong, You used the normal instead of the vector from vertex to light (VPpli in OpenGL spec)

    And for local viewer optimizations, you don't need to calculate (EyePos - VertPos). Eye position is the origin (0,0,0), a negation of the world vertex position is enough. So the half angle vector gets
    h = normalize(VPpli - normalize(VertPos));

    Oh, and another one:
    The spec defines this dot_multiply symbol (the circle with a point, here an 'o') as
    d1 o d2 = max(dot(d1, d2), 0.0);

    This is not the same as clamping between 0 and 1 you did.
    I partly withdraw the last, normalized vectors don't exceed 1.0 on a dot operation. But a max is what the spec does.

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Nov 2002
    Location
    Latvia
    Posts
    626

    Re: Specular wrong

    Yes it was my post, I noticed that stupid mistake & deleted it. Now everything works as it should, only the specular part seem to differ. Maybe it's precision problem. I'm working on NV3x (halfs?)

    clamp(dot(),0,1) should do the same as max(dot(),0) if outputted to color register.

    Can't make a zip, updating ftp from home is impossible because of net bugz.

Posting Permissions

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