Cg Programming/Unity/Two-Sided Smooth Surfaces

This tutorial covers two-sided per-pixel lighting (i.e. two-sided Phong shading).

Here we combine the per-pixel lighting discussed in with the two-sided lighting discussed in.

Shader Coder
The required changes to the code of are: new properties for the back material, duplication of the passes with front-face culling for one copy and back-face culling for the other copy, and negation of the surface normal vector for the rendering of the back faces. It's actually quite straightforward. The code looks like this:

Summary
Congratulations, you have reached the end of this short tutorial. We have seen:
 * How two-sided surfaces can be rendered with per-pixel lighting.