You are here: Articles

Sapphire (red, cut)

At the beginning of last year (2007) I was playing around with Carrara's shader editor to achieve what I would call a "good compromise" between physical correctness and capability of software concerning shaders of various types of cut and uncut gemstones.
The first goal was to achieve a convincing look for the shaders of various gemstones in cut and uncut versions whereas the second goal was to simulate as many physical/optical effects as supported by Carrara 5 Pro without using other plug-ins than the software itself.

Assumptions

Both approaches assume that you are quite comfortable with both the Carrara 5 shader editor and the Vue 6 Infinite shader editor. As well both approaches are geared towards realism and not towards render speed so if you are looking for an approximation of these optical effects this article won't give you an answer to that.

Nodes we won't need...

Despite the seductiveness of the Color, Highlight, Alpha and Shininess entries in the Carrara 5 shader tree, I didn't use any of them. The obvious color of a gemstone is produced by its other optical properties and not diffusive light (at least not within Carrara). Moreover - 4 partial shaders less to do.
Obviously a cut gemstone doesn't have a Bump - in that case I'd want my money back from the gemstone cutter - one less to do. On to Subsurface Scattering and Glow ... both do not apply to gemstones.

Refraction

Ruby (red, cut)

Now for the easy part, the Refraction: refraction usually varies a little bit in the second and third decimal digits of the index of refraction (IoR) which can be obtained from the gemstone tables here or from various sources over the Internet.
So we will use a Blender node driven by a Fractal Noise to blend the highest and lowest values together (for a cut ruby this would be rounded 1.76 and 1.78). It is a pity that Carrara 5 doesn't display more than 2 digits after the decimal point but you have to observe the final image "very" closely to see the differences anyway. All in all these variations add a little more natural look to the shader.
The tricky part are the remaining nodes in the Carrara 5 shader tree: Transparency, Reflection and Translucency. All three are needed to achieve the intended impression of a gemstone.

Fresnel Term

Peridot (cut)

Before the fun part of working on the transparency we have to be clear on what a fresnel term is: The moment a light ray transfers a medium that has an IoR other than 1, it will - depending on the camera's angle looking at the scene - cause a reflection where normally a refraction happens. Most 3D packages ignore the fact that a pure IoR of 1 only happens in vacuum so we will ignore the fact as well since putting the whole scene inside an enormous sphere with 100% transparency and an index of refraction of 1.000293 (IoR for air at 20 °C) that cannot be entered (see above) but slows down render times ... no we won't do that.
Back to our fresnel term: Carrara 5 won't let us enter a typical fresnel parameter as a "fresnel term" or a "brewster angle". Instead it offers us a percentage value. Since the fresnel term isn't something like a "percentage of something" we will have to adjust different nodes in the shader tree to get the fresnel effect we want.
Thus we enter the rounded brewster angle (which is defined as arctan(IoR[gemstone]/IoR[air]) as percentage of the Fresnel Term in the shader node for Transparency. Then we switch to the Reflection node and set the value of the Fresnel Term to the same value. We use a basic Value shader as driver for the Reflection node and enter a value slightly higher than the one we entered for the Fresnel Term. Wasn't that complicated and the first step in developing the transparency node is done.

Transparency

Now for the part of the light that isn't reflected but passes through our gemstone: Transparency in Carrara 5 is more than just a mathematical number. You can plug any color node in this shader node and that is exactly what we will do. The colored impression of a gemstone is achieved by the light that transmits through it so we will have to blend in the amount of transparency with some colors.

Translucency

Fire Opal (cut)

To compensate for the missing 2% of transparency (remember: we haven't defined any Color, Highlight or Shininess) I added a small amount of Translucency (5%) to the shader so that some light would be transmitted back out of the object just below the surface.
To achieve a more realistic look I used Blender nodes driven by Fractal Noise, blended 4 colors together and blended the resulting color again together with the percentage Value of the transparency (which I set to 98%). In the case of our cut ruby that made 4 reddish Color nodes, 3 Blenders driven by Fractal Noise and a Value parameter for the intensity (98%) of the Transparency node.

Test environment

One way to test these shaders is by using a simple scene with an object that has hard and round edges and another object that is positioned behind the first so that transparency can be checked. Both are positioned on a plane (not infinite!).
I used Carrara's G.I. with a neutral studio light HDR by Dosch Designs as illumination. The idea behind the test scene is to reduce the influence of other light phenomena (such as spot lights, clouds, etc.) as much as possible. Enabling caustics in the render settings usually is necessary with gemstones.