CD SHADER TUTORIAL
Or "How to fake a diffraction map", by Leo Santos

 

Before anything, let me say that although this tutorial is specific for 3DS Max, the concepts can be applied to any software, so if you use other programs feel free to go ahead.

You can notice I used the word "diffraction". That is the physical phenomena we'll be simulating in this tutorial, in a very simple way, using only Max's native gradient ramp shaders (or Maya's, or XSI's, or Lightwave's ...). You can learn more about diffraction here. Let's start, shall we?

First thing, we create a simple geometry, basically some extruded splines. One is a flat surface, the metallic foil inside the CD, the others are the plastic parts that cover it.

Now we create two materials, one for the plastic, a basic transparent shiny material, and one for the actual CD surface, the metallic foil where the information is recorded. We'll focus on this one

Let's use the Anisotropic Shader, because it provides better hilights than the old Blinn shader in Max (which tends to over-saturate around the hilights).

Keep the diffuse color dark for now, but you'll be able to fine tune it later.

 


Now we'll do a generic environment reflection. A gradient ramp map will do it. You can use any map you want, but I like gradient ramps because you get a lot of control over the final result.

Set it to spherical environment, and it will behave as a sphere that wraps around the whole scene, perfect for a reflection.

Keep in mind that this is a basic setup, you can have all sorts of variations, including raytraced reflections, but it may be more difficult to make it look like you want.

 

Well, let's see how it looks so far. Press F10 and render it.

Naah, not exactly what we need.... let's keep working on it.

Next we'll simulate the "rainbow" effect caused by the light diffraction. It's very simple, actually. Just drop another gradient ramp, this time on the Specular color slot, and add the colors.

Like the reflection, this one will be a Spherical environment.

Notice the gradient type is set to "normal". This handy feature makes the gradient color depend on the angle between the polygon normal and the camera.

There may be other ways to do it, and even ready to use rainbow shaders, but what's great about this way is that, again, you can tweak the look as much as you want.

One thing to keep in mind, tough, is that different programs (or base shaders, like the Brazil R/S advanced shader) may not behave like Max's Anisotropic shader, and you may have to actually map the rainbow gradient directly on the reflection. But if you render this shader in Max, regardless of the render you should get the same result (I tested it on the Scanline renderer, Brazil R/S and Mental Ray).

 

Ok let's see it now.

Better... but not "good" yet.
Now comes the little trick... we'll add a bump map, so it fakes the surface curvature, in order to see a wider range of the reflection map. How do we do it?

We add another gradient ramp!

This time, on the bump map channel. Why? Remember that we set the rainbow gradient to "normal". Well, bump maps (or normal maps) affect the normal of a surface.

If we use a smooth radial gradient from white to black, and map it properly, we'll fake the surface into being curved, thus seeing much more of the reflection map.

You'll have to apply a planar mapping on the metal foil object. I used map channel 01.

 


This is how the Bump map must look applied on the surface.

Ok, Now we render it.

Tah Dah!!!
Some final considerations:

Different CDs under different light conditions and in different environments will have a different look. Play around with the parameters and maps until it looks like you want.

It will render just fine in Scanline, but using renderers like Mental Ray or Brazil (or Vray, etc...) will give you a better sampling, specially on the borders, where the bump map tends to look crunchy without a good sampling.

All images and text are copyrighted, don't use without permission !

 

Back to Tutorials

Back to Leo Santos home