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:
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:
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.
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.
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:
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.
Now pressing ShiftA in the Viewport gives you new options:
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.
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.
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.)
Setting Clamp Indirect to something like 10 also helps to reduce fireflies.
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:
After compositing (final result):
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.
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:
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.