Talk:Mathematics of glTexGen: Difference between revisions

From OpenGL Wiki
Jump to navigation Jump to search
Derodo (talk | contribs)
Created page with 'Don't know if this is the right place for writing this, but I was just applying the maths mentioned in the article, and I think the GL_SPHERE_MAP calculations are not correct, fo…'
 
Derodo (talk | contribs)
No edit summary
Line 1: Line 1:
Don't know if this is the right place for writing this, but I was just applying the maths mentioned in the article, and I think the GL_SPHERE_MAP calculations are not correct, for where it says:
Don't know if this is the right place for writing this, but I was just applying the maths mentioned in the article for a project I was working on, and I found out the GL_SPHERE_MAP calculations are not correct, for where it says:


'''reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeNormal, myEyeNormal);'''
'''reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeNormal, myEyeNormal);'''
Line 15: Line 15:
'''m = 1.0 / ( 2.0 * sqrt(dot3D(reflectionVector, reflectionVector)) );'''
'''m = 1.0 / ( 2.0 * sqrt(dot3D(reflectionVector, reflectionVector)) );'''


I'm not a maths expert, though I figured all that out when trying to apply the formulas for a project I was working on, and realized the results were not correct.
I'm not an expert on the subject, but having checked the OpenGL reference pages and looking carefully at the glTexGen documentation, it seems the original formula posted on this page was not correct.
 
Did any one noticed this too? I just don't dare to edit the page myself, just in case I'm wrong.

Revision as of 23:04, 14 November 2010

Don't know if this is the right place for writing this, but I was just applying the maths mentioned in the article for a project I was working on, and I found out the GL_SPHERE_MAP calculations are not correct, for where it says:

reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeNormal, myEyeNormal);

It should be:

reflectionVector = myEyeVertex - myEyeNormal * 2.0 * dot3D(myEyeVertex, myEyeNormal);

And where it says:

m = 1.0 / 2.0 * sqrt(dot3D(reflectionVector, reflectionVector));

It should be:

m = 1.0 / ( 2.0 * sqrt(dot3D(reflectionVector, reflectionVector)) );

I'm not an expert on the subject, but having checked the OpenGL reference pages and looking carefully at the glTexGen documentation, it seems the original formula posted on this page was not correct.