Tuesday, February 23, 2010

A fun distraction - Topographic Contour Shader

While working on the normal re-calculation for my spherical deformer vertex shader, I got distracted by an idea I had. Thinking about Avatar, and virtually any other movie with high tech 3D displays of terrain, I thought it would be cool to develop a fragment shader to draw the object as stacked countour lines, like those found on a topo map.

I developed a simple version using modulus of one spacial dimension, but the results weren't quite the "wireframe" look I was going for. With the help of this thread I learned about smoothstep() and was able to get exactly what I was going for.

No comments: