Diffraction
Grating 101 Download the sample project and material file Click here to see a Quicktime animation of the sample I was sitting in front of the television one day (as I do many a day) and saw an ad for Pixar's "A Bug's Life." While watching the animation I was intrigued by the iridescent qualities of many of the surfaces, and like most computer animators I wondered how I might be able to do that in my software. In this example I used Animation Master 6.1 (AM), but it should work with any of the standard 3D packages. I don't want to go into great detail about physics of light and how diffraction grating or iridescent materials work. I will say, however, that in the computer world, many of the same real world rules apply. The two important things for us to note in this example of diffraction grating: 1) In the real world, the angle at which the light hits the surface has a great deal to do with the amount and type of color spectrum you get reflected back. 2) Small parallel grooves control how the color spectrum is spread over the surface. I started by tackling how to get the light to change the color of the surface. Fortunately AM makes this easy by allowing us to change the specular color of a material.
From that I figured I could use a gradient combiner with a node for each color in the spectrum. The specular colors would carry the spectrum while the same base color is applied to all attribute nodes.
The values of the gradients start/end position settings are ALL set to zero, then the threshold settings are used to blend the colors. The values in my material were as follows: red node= 70 To illustrate how the gradients work together I applied the spectrum colors to the base attributes.
This is an example of the final diffraction grating material applied to Thom.
This material can easily be modified to become satin, insect bodies, and the like by changing the base color and/or the spectrum colors. When working with this material you will notice that the only time the spectrum stands out is when it is on a curved, irregular surface. When it is applied to a flat plane, the color spectrum gets very spread out and only one or two colors are visible at a time. This moves us to point two, diffraction grating is a bunch of tiny grooves packed close together. So, for example to replicate a CD, we also need to replicate the tiny grooves that make up the CD surface. I experimented with bump maps and displacement maps, but found the best results came from modeling the grooves. I started my new model by making a bunch of short splines arranged like the profile of a venetian blind. These splines will receive the diffraction grating material. The more grooves, the smoother the surface. I also modeled the the back surface of the disk as well as the center.
I lathed all of the splines. I also applied a clear plastic material to the center/backing splines.
And then render the image. That's it! Don't use reflections on the actual diffraction material when making a CD. It will give very strange artifacts in the surface. Use the "plastic case" of the disk to receive the reflections. The nice thing about using this method for the diffraction grating is that it animates accurately without any need for animated texture maps. Also by changing the type of combiner you can create "oil slick" type of materials
click to download the sample "oil slick" material
|
| If you have any questions, feel free to
email me at charles@babbagepatch.com Go visit the main site BabbagePatch.com Also visit |