Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
  Phong Shading and Reflections  
 
 

Camil Moujaber made this amazing picture with his ray tracing program.

The program uses Phong shading techniques to smooth out objects composed of polygons. In this image, the sphere, torus, cone, and cylinder are all built from polygons. The Phong shading model allows the program to make the polygons blend smoothly so you see smoothly shaded surfaces.

If you look closely at the curved edges of the solids, you can see the polygons. For example, along the upper curve of the torus or sphere you can see corners caused by the polygons that define the solid.

A stranger effect occurs in the reflections produced in the solids. The program uses the Phong algorithm to generate the solid's normal at the point of reflection (where a ray bounces off of the solid) but the point of intersection is still on the flat polygon. That seems to lead to discrete bends in the reflected image. For example, look closely at the reflection of the floor in the sphere. You can see angles in the floor's squares.

I'm not sure what the best solution to this problem is. Using analytical objects such as spheres and cones rather than solids approximated by polygons would do the trick but might be impractical for some complex solids. Using more, smaller polygons would give better results but would take a lot longer to render. (Either of these methods would also reduce the "corners" visible along the edges of the solids.)

 

Copyright © 1997-2006 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated