Normal Perturbation

Hark back to Smooth Triangles, when you made triangles appear curved by modifying the normal that was reported to the renderer. It turns out that this technique can be used in a variety of ways, basically “lying” to the renderer so that the surface shading is done with modified normals. Check out the image, showing this technique applied to spheres and a plane.

images/next/normals.png

By attaching a function to the shape (perhaps directly, or maybe via the material), you can have your normal_at function call the attached function to perturb, or add a small vector to, the normal at the given point. In the preceding image, the red sphere uses a sine function to make the surface appear wavy, the blue sphere uses another function to give the surface a quilted appearance, and the green sphere and the plane are both using three-dimensional noise to make the surface look deformed.

This technique can be applied to glass to make it appear etched or frosted, too. And you can even combine it with texture mapping to let an image file define a normal map that describes how the normal should be perturbed at any given point.

Besides textures, you can also explore new shape primitives, to increase the variety of your scenes. One such primitive you might try is the torus.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.183.89