Jump to content
  • Advertisement
Sign in to follow this  
rcz

OpenGL Phong Interpolation in OpenGL /w Cg

This topic is 4325 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to do Phong normal interpolation using Fragment shader in Cg with OpenGL. Yet it seems the Fragment shader is not getting an interpolated normal from the Vertex shader. I can compute per-pixel illumnation, but not with interpolated normal. Also, Fragment shader does not appear to have access to bilinear interpolants (u,v) so i cannot interpolate the normal myself. Here is a better explaination of issue: http://www.rchoetzlein.com/phong The final phong-interpolated images were created with 3D Studio, not OpenGL. I believe this may be because OpenGL does not support phong-interpolation. See docs for glShadeModel (GL_FLAT or GL_SMOOTH=Gouraud). But the hardware should support phong-interpolation. Is there any way to check if graphics card is not able to do normal interpolation? Any comments?

Share this post


Link to post
Share on other sites
Advertisement
I figured it out.. I was not renormalizing the surface normal in the Fragment shader. If you want phong-interpolation, you must renormalize in the Fragment shader even if you normalized it in the Vertex shader as the normal is phong-interpolated (and no longer normalized) between the two shaders.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!