24
$\begingroup$

What would be the material or shaders node set up for a smooth gem in blender cycles engine?

I want a result similar to this image:

enter image description here

$\endgroup$
35
$\begingroup$

You need dispersion

Dispersion is the phenomenon of multicolored highlights you see in most transparent substances, resulting from different colors (light frequencies) refracting at different angles (the prism effect).

Your reference image does not have this, which makes it immediately noticeable as CG. Instead I would suggest by starting with a reference like this one.

Kent Trammell explained this elegantly in a tutorial that was published on CGCookie but has since been removed. The first person to do it was probably Kirado, who shared the node setup.

Here is the basic node setup - note how the IOR values differ:

Basic dispersion node setup

Taking it further...

After doing some renders with the above setup I felt that the material still looked too dark, so I decided to try mixing it with a plain white Glass Shader in a way that would not interfere with the colorful highlights. The "Is Camera Ray" output of the Light Path Node seemed to work pretty well for this. What it does is takes any area where the RGB summed color is not already reaching the camera, and allows the white (clear) Glass color to shine through just in those gaps.

The IOR of diamond is 2.4175 and the dispersion is .044. So by using these values, as well as a realistic diamond size, we can get something much more accurate. Make sure to apply the scale (CtrlA) of your diamond object if you want the refraction to be as accurate as possible.

A dispersion setup for diamonds

Keep in mind that we are still "faking it" by having only three set IOR values (for red/green/blue). But practically speaking this turns out to be totally sufficient.

Geometry matters

With gems like diamonds, the cut determines the way the light gets reflected. Geometry plays an important role in the appearance of this material.

A page on diamond.com has diagrams that explain this really well:

Why geometry matters with gems

Luckily, creating an ideal diamond mesh can be done in Blender in an instant. Just enable the Extra Objects (Mesh) add-on, and it will be an option in your Add Mesh menu.

Add Mesh - Extra Objects

Now pressing ShiftA in the Viewport gives you new options:

Add Mesh - Brilliant Diamond

In my example I slightly beveled my diamond, which allowed me to use Smooth Shading instead of Flat Shading. This did away with the angular "CG look", and scattered the light in more directions, brightening the gem. However, it has since been brought to my attention by user Thom Blair III that diamonds are sharp down to the molecular level, so a bevel is not accurate. Consider using Simple Subdivision instead.

Lighting matters

An HDRI environment map will provide a more diverse color palette of light for your scene, so consider using one if you want more realistic lighting.

If the environment color is not quite to your liking, either change to a better-suited environment map or adjust the color using a Hue/Saturation/Value Node. In my case the sky was too blue, so I reduced the saturation.

Altering the environment color

Rendering

A material like this requires a high sample count for it to look clear (I used 7500 samples!). *Update: With the new Denoise feature you don't need anywhere near this many samples now! Many thanks to Blender's developers.

If the gemstone will be part of a larger scene where other elements do not require such a high sample count, you can keep the gemstone on its own Render Layer to keep render times from becoming ridiculous. (Okay, I mean keep them less ridiculous.)

Giving the gemstone its own render layer with a separate sample count for performance purposes

Setting Clamp Indirect to something like 10 also helps to reduce fireflies.

Clamp Indirect

Compositing

If you want to adjust the exact color of your gem, or add bloom and streak effects, you can use the compositor to put on the final touches.

An example node setup for compositing:

Compositing node setup

Before compositing:

Just the rendered output, before compositing

After compositing (final result):

After using compositing to add extra "bling"

$\endgroup$
  • 2
    $\begingroup$ Could you share the final Blender file, please? $\endgroup$ – Wouter Jan 21 '16 at 11:58
  • 1
    $\begingroup$ Actually, the beveling of all the edges of the diamond might not be a good idea, as it gives the facet edges a rounded, soft look. With a professionally cut real diamond, the carbon molecules' crystal structure will actually make such a sharp edge that no roundedness will be perceivable to the unaided eye, as shown here. $\endgroup$ – Thom Blair III Feb 18 '16 at 17:48
  • $\begingroup$ @ThomBlairIII Wow, that's impressive! Did not know that. I suppose that's why diamonds are good for cutting glass. I will revise that part based on your feedback. Thanks! $\endgroup$ – Mentalist Feb 19 '16 at 3:08
  • $\begingroup$ @Wouter Unfortunately, the .blend contains an HDRi sky texture that I do not have the rights to redistribute. But for creating the diamond material all the info you need is in the screen shots above, and the compositing node parameters will vary depending on your scene anyway. $\endgroup$ – Mentalist Apr 24 '16 at 6:15
  • $\begingroup$ Thanks for posting this super useful answer (with a technical explanation). Shine on you crazy diamond ;). $\endgroup$ – Paul Gonet Dec 6 '16 at 0:38
4
$\begingroup$

Try another Renderer

Other than trying to fake it in Cycles node-setups, there is always the possibility to use a renderer with built in dispersion and advanced light transport integrators, that provide less noisy and more accurate caustics than cycles. One of those is LuxRender. One of the technologies behind this awesome renderer is called Metropolis light transport, for further reading on this topic, maybe start with the links at the bottom of the wiki page.

This rendering contains only three lightsources (sun & sky, one big softbox). As you can see, you get very nice and crisp caustics, als well as subtle dispersion. I later saw, that my diamond is about two meters big, I guess the dispersion would look even better if I used real word scale.

Caustics and dispersion in luxrender

I let this one render almost 19 hours. It rendered over night so i can't say at wich point it was noise free. This is how it looked after 50 min:

enter image description here

I used the "Bidirectional" integrator, with Metropolis Light Transport, using CPU and GPU together (i5 + 1080ti with OpenCL). The pure OpenCL integrators (GPU only) showed a big difference in the quality of the caustics, I'll need to look into it a bit deeper, to see how I can render this scene GPU-only with the same quality.

For the diamond I used a standard glass material with the IOR preset "diamond", no other adjustments were made to that shader. For suzanne I added a clear absorption volume to a standard glass shader with roughness enabled.

The LuxRender nodes contain a great variety of IOR presets. LuxRender IOR presets

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.