Monday, September 17, 2012

Playing with Phong shading

While going through an example in the OpenGL SuperBible 5, I came across the Phong lighting model. Its  one of the tricks which helps create those amazing 3D pictures.

Looking closer at the equations, I found that a bug in the specular lighting calculations, which is reported here... https://code.google.com/p/oglsuperbible5/issues/detail?id=47

Here is what a phong shaded sphere looks like...


Now, its time to play with the fragment shader a bit... added some trigonometric beauty (  cos(600*x)*exp(-pow(20*x, 2.0)) ) to the reflection point...

Math is fun.

No comments:

Post a Comment