View Full Version : Specular wrong
03-24-2004, 07:30 AM
I have written small demo app to demonstrate differences between fixed function pipe and fragment shaders
But it seems that specular component is wrong. Or maybe ffp isn't clamping negative values :confused:
Switching ffp/fsh: F1,F2
Increase/decrease tessalation: PgUp,PgDown
03-24-2004, 09:15 AM
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.
03-24-2004, 10:01 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.