Creating an Accurate Diamond Material in Blender

Creating an Accurate Diamond Material in Blender

This right here is the node setup

As you can see it is a really small node setup, but packed with Mathematical equations, involving Snell’s Law. For the 2 nodes off to the left (the top one is named ior, and the bottom is named dispersion) they are just value nodes that I renamed by pressing f2.

Overview of the Node Setup

The node setup primarily uses the Glass BSDF shader to simulate the optical properties of a diamond. Here is a breakdown of each component and its role in the simulation:

  1. IOR (Index of Refraction) Node:

    • This node sets the Index of Refraction for the glass shader. For diamonds, the IOR is typically around 2.417. In the setup, this is set to 2.400. You can find a list of IOR values from Wikipedia here.
  2. Dispersion Node:

    • This node controls the dispersion effect, simulating how light splits into different colors when passing through the diamond. A typical value is around 0.044, but the setup uses 0.100 for enhanced dispersion.
  3. Multiply Node:

    • This node multiplies the dispersion value to control the extent of color splitting. In the setup, the value is multiplied by 2.
  4. Add Nodes:

    • These nodes combine the dispersion values with the base IOR to create slightly different IORs for the red, green, and blue components of light. This simulates the chromatic aberration.
  5. Glass BSDF Nodes:

    • These nodes use the different IORs for the red, green, and blue channels to simulate the dispersion effect. Each Glass BSDF node is assigned one of the IOR values calculated.
  6. Light Path Node:

    • This node helps in optimizing the render by controlling how light paths are calculated. It checks if the ray is a transmission ray, which helps in deciding if the Glass BSDF should be applied.
  7. Add Shader Nodes:

    • These nodes combine the Glass BSDF shaders for the red, green, and blue channels into a single shader output, effectively merging the dispersion effects.
  8. Mix Shader Node:

    • This node blends the final combined shader with an additional Glass BSDF shader, ensuring the correct combination of reflection and refraction.\text{Final Shader} = \text{mix}(\text{Shader}_{\text{combined}}, \text{Glass}_{\text{additional}}, \text{factor})

Mathematical Explanation

Refraction and Dispersion in Diamonds

The optical properties of diamonds are heavily influenced by their high refractive index and dispersion:

  • Snell’s Law: Refraction at an interface between two media with different IORs is given by:

    n1sin(θ1)=n2sin(θ2)n_1 \sin(\theta_1) = n_2 \sin(\theta_2)

    Where n1n_1 and n2n_2 are the indices of refraction, and θ1\theta_1 and θ2\theta_2 are the angles of incidence and refraction.

  • Dispersion: The change in IOR with wavelength λ\lambda leads to chromatic dispersion, given by:

    n(λ)=n0+k(λλ0)n(\lambda) = n_0 + k(\lambda – \lambda_0)

    Where n0n_0 is the base refractive index, kk is a dispersion constant, and λ0\lambda_0 is a reference wavelength.

Combining Refraction and Dispersion

To simulate a diamond’s sparkle, multiple Glass BSDF nodes with slightly different IORs are used to mimic the dispersion effect. Each color channel (red, green, blue) has its own IOR value:

  • Red:

    nr=n+Δnadjustedn_r = n + \Delta n_{\text{adjusted}}
  • Green:

    ng=nn_g = n
  • Blue:

    nb=nΔnadjustedn_b = n – \Delta n_{\text{adjusted}}

These values are fed into separate Glass BSDF nodes, and their outputs are combined using Add Shader nodes to achieve the dispersion effect.

Reflection and Refraction Combination

The final step combines the dispersed shader with an additional Glass BSDF to ensure accurate rendering of both reflection and refraction. The Mix Shader node blends these effects based on a specified factor, ensuring the diamond looks realistic under various lighting conditions.

Application in Blender

By using this node setup, you can create highly realistic simulations of diamonds and other gemstones. The key aspects include:

  1. Accurate IOR Values: Setting the correct IOR for diamonds.
  2. Enhanced Dispersion: Simulating the splitting of light into its constituent colors.
  3. Combining Effects: Using Mix Shader to balance reflection and refraction.

This setup ensures that the diamond shader captures the brilliant sparkle and chromatic effects typical of real-world diamonds.

Winston is a 3d artist and game developer.