36
$\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$
6
  • $\begingroup$ You have a double question in here, please, one at a time. I'd take out to bit about compositing, $\endgroup$ Commented Oct 18, 2015 at 18:54
  • 1
    $\begingroup$ This tutorial should have you completely covered on the gem: blenderguru.com/tutorials/…. $\endgroup$ Commented Oct 18, 2015 at 18:57
  • $\begingroup$ Related: blender.stackexchange.com/q/18613/599 $\endgroup$
    – gandalf3
    Commented Oct 18, 2015 at 19:11
  • 1
    $\begingroup$ A simple glass shader with a rather high IOR value should work. Look up the IOR of the real life material you want to make and use that (Try 2.417 - 2.541) $\endgroup$ Commented Oct 18, 2015 at 20:31
  • 3
    $\begingroup$ Play with the IOR values. And pay close attention to your lighting and the relfections. Every time you are dealing with highly reflective materials (like glass, or metals) it's the environment that surrounds them what's important. See: blender.stackexchange.com/questions/30609/… and blender.stackexchange.com/questions/15683/… $\endgroup$
    – user1853
    Commented Oct 18, 2015 at 20:32

3 Answers 3

51
$\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.

enter image description here

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$
6
  • 2
    $\begingroup$ Could you share the final Blender file, please? $\endgroup$
    – Wouter
    Commented Jan 21, 2016 at 11:58
  • 3
    $\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$ Commented Feb 18, 2016 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
    Commented Feb 19, 2016 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
    Commented Apr 24, 2016 at 6:15
  • 1
    $\begingroup$ Thanks for posting this super useful answer (with a technical explanation). Shine on you crazy diamond ;). $\endgroup$
    – Paul Gonet
    Commented Dec 6, 2016 at 0:38
10
$\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$
0
$\begingroup$

Don't Flame Me It's Just Science

I realise there are artistic motives as well as a desire for realism. This question seems to be calling for some physical accuracy and so some science would be appropriate.

Standard IOR is for Yellow not Green

From a realism perspective, it is perhaps important to note that the standardised index of refraction is for light at a wavelength on the Fraunhofer $D$ line (footnote 1). This is a wavelength of 589.29 nm (footnote 2) and is yellow (indeed, close to orange), not green (footnote 3). The $D$ line of Sodium is derived as the midpoint of the two lines $D_1$ (589.592 nm) and $D_2$ (588.995 nm) in the absorption spectrum of Sodium (footnote 2).

Applicability of Dispersion

Further, there are different methods to determine dispersion with respect to gems and they use different Fraunhofer lines to define the long and short wavelengths (footnote 4). So, while diamond's dispersion of 0.044 can be correct, it is physically accurate only when your long wavelength correspdonds to the Fraunhofer $B$ line (Carbon Dioxide, 686.719 nm, red) and your short wavelength corresponds to the Fraunhofer $G$ line (disputed between: Iron, 430.790 nm; Calcium, 430.774 nm; both violet). See footnote 4 re. dispersion in gemology; footnote 3 re. colour vision, footnote 2 re. disputed wavelength of Fraunhofer $G$ line. Note that the $B$ and $G$ are Fraunhofer's labels for the dark lines in spectral absoprtion patterns, not abbreviatons for blue or green. See footnote 2.

No Need to Judge Colour by Eye, Use Nodes

Artists, and many others, have an awesome eye for selecting and matching colours. If we're really honing in on realism though, Blender can help.

Blender's shader node system has a wavelength conversion node to obtain a colour from a wavelength. See footnote 5 for an example.

Information Still Missing

Afer taking into account the above information, there are still some shortcomings if absolute physical accuracy is desired:

  • The relationship between index of refraction and wavelength is not demonstrated to be linear across the spectrum.
  • From the information above, we have only three points (red, yellow and violet) on this potentially non-linear line.
  • Although we have a precise point for yellow, we have only a difference of IOR between red and violet, not a precise value for either. This presents a degree of freedom for the IOR of red and violet. If the IOR-wavelength relationship is linear, the IOR for red and violet have to be specific values (complicated by the dispute about violet, highlighted below).
  • The wavelength that defines violet light in this scheme is disputed. This presents a second degree of freedom. The wavelength difference in the dispute is 0.016 nm so, for most purposes in Blenderland, I suspect this point can be disregarded.

Footnotes

1 Standard wavelength for index of refraction:

"Standard refractive index measurements are taken at the "yellow doublet" sodium D line, with a wavelength (λ) of 589 nanometers."

Wikipedia "List of refracive indices": https://en.wikipedia.org/wiki/List_of_refractive_indices

[2] Fraunhofer lines:

"Line, Element, Wavelength (nm)

$B$, $O_2$, 686.719

$D_1$, $Na$, 589.592

$D_2$, $Na$, 588.995

$G$, $Fe$, 430.790

$G$, $Ca$, 430.774"

Omitting Fraunhofer lines not discussed.

"The D1 and D2 lines form a pair known as the "sodium doublet", the centre wavelength of which (589.29 nm) is given the designation letter "D""

Wikipedia "Fraunhofer lines": https://en.wikipedia.org/wiki/Fraunhofer_lines

[3] Colour Vision:

"Violet: 380–450 nm

Blue: 450–485 nm

Cyan: 485–500 nm

Green: 500–565 nm

Yellow: 565–590 nm

Orange: 590–625 nm

Red: 625–750 nm"

Wikipedia "Colour vision": https://en.wikipedia.org/wiki/Color_vision

[4] Dispersion in gemology:

"In the technical terminology of gemology, dispersion is the difference in the refractive index of a material at the B and G (686.7 nm and 430.8 nm) or C and F (656.3 nm and 486.1 nm) Fraunhofer wavelengths, and is meant to express the degree to which a prism cut from the gemstone demonstrates "fire"."

Wikipedia "Dispersion (optics)": https://en.wikipedia.org/wiki/Dispersion_\(optics\)#In_gemology

[5] Example Blender node network for colours in physically accurate dispersion: enter image description here

$\endgroup$

You must log in to answer this question.