Simon’s Graphics Blog

# Continuous Silhouettes

Silhouettes are commonly used for real-time shadowing algorithms. Usually these are generated from the existing edges of a mesh using the face normals. Since shading is usually interpolated over the triangle from the vertex normals, this can introduce shading artifacts where the vertex and face normals do not agree. In addition, these silhouettes move discontinuously when the light or mesh is in motion, which can cause nasty popping artifacts when using penumbra wedge soft shadows, since the projected penumbra volumes are very sensitive to the distance from the silhouette edge to the light source.

This post describes an idea of how to generate silhouette geometry using the vertex normals of a mesh. These silhouettes match the vertex lighting exactly, and also move continuously under smooth lighting or geometry changes.

Note: since writing this article I’ve found a SIGGRAPH 2000 paper that uses a similar isocontour technique for NPR shading. The paper is by Hertzmann and Zorin on Illustrating Smooth Surfaces. I haven’t yet found anyone doing any work related to stencil volumes using this technique, so I’ll attempt to put a demo together when I have the time and see what it looks like. :)

## Algorithm Overview

Consider the gouraud-shaded triangle in the diagram below:

The attributes are linearly interpolated between the vertices using barycentric coordinates, and in particular they are linearly interpolated across the edges. Therefore it is possible to efficiently cut a triangle along a zero by testing the sign of the attribute at each vertex. If one vertex has a different sign to the other two, then the two edges that meet at this vertex contain the end-points of the cut. The end-points can trivially be found by solving (1 - t)a + tb = 0 for t on each edge.

For the case that the mesh is globally continuous, these cut vertices will always agree, since the vertex attributes agree for each face that shares a given edge. If a given edge is discontinuous, you will need to generate linking cuts to ensure that you generate closed silhouette loops.

## Results

The above algorithm has been implemented using OpenGL and compared with the silhouette edges generated using face normals.

The yellow lines are the silhouette edges generated by this algorithm. The blue lines are the silhouette edges generated using the traditional face-normal method. Note that the yellow silhouette matches the vertex lighting much more closely.

## Future Work

The main applications for this technique are:

• Hard Stencil Shadows. Using continuous silhouette edges should eliminate the popping artifacts caused by the disagreement of vertex-lighting and face-shadowing.
• Penumbra Wedge Soft Shadows. Using continuous silhouette edges as penumbra wedge sources should eliminate the animation artifacts caused by depth discontinuities in traditional silhouette edges.