Previous page Next page

Surface Finishes

One of the main features of a ray-tracer is its ability to do interesting things with surface finishes such as highlights and reflection. Let's add a nice little Phong highlight (shiny spot) to the sphere. To do this we need to add a finish keyword followed by a parameter. We change the definition of the sphere to this:

  sphere { <0, 1, 2>, 2

    texture {

      pigment { color Yellow } // Yellow is pre-defined in COLORS.INC

      finish { phong 1 }

    }

  }

We render the scene. The phong keyword adds a highlight the same color of the light shining on the object. It adds a lot of credibility to the picture and makes the object look smooth and shiny. Lower values of phong will make the highlight less bright (values should be between 0 and 1).

Previous page Next page