Simulating Subsurface Scattering in Cycles using the Ray Length output in the Light Path node

In this recipe, we will create a fake Subsurface Scattering material using the Ray Length output of the Light Path node.

Simulating Subsurface Scattering in Cycles using the Ray Length output in the Light Path node

The Rendered result of the fake SSS material of this recipe

Getting ready

Start Blender and open the 9931OS_07_start.blend file.

  1. Go to the Render window, and in the Sampling subpanel, click on the Method to sample lights and materials button to switch from Path Tracing to Branched Path Tracing. Enable the Square Samples item, and under AA Samples, set the Render value to 8. Finally, click on the Pattern button to select the Correlated Multi-Jitter item.
  2. Save the file as 9931OS_07_SSS_raylength.blend.

How to do it...

Let's create the material using the following steps:

  1. Select the Suzanne object. Click on the New button in the Node Editor window toolbar or in the Material window to the right of the screen. Rename the material SSS_raylength.
  2. In the Material window, switch the Diffuse BSDF shader with a Mix Shader node. Label it as Mix Shader1. In its first Shader slot, select a Diffuse BSDF shader. In its second Shader slot, select a new Mix Shader node. Label this node as Mix Shader2.
  3. Go to the Mix Shader2 node. In its first Shader slot, select a new Mix Shader node and label it as Mix Shader3. In the second Shader slot, select a Glossy BSDF node.
  4. Add a Layer Weight node (press Shift + A and navigate to Input | Layer Weight) and connect its Facing output to the Fac input socket of the Mix Shader1 node. Set the Blend value to 0.950.
  5. Set the Fac value of the Mix Shader2 node to 0.200 and the Fac value of the Mix Shader3 node to 0.700. Set the Glossy BSDF node's Roughness to 0.100.
  6. Connect the Diffuse BSDF node output to the first Shader input socket of the Mix Shader3 node. Add an Add Shader node (press Shift + A and navigate to Shader | Add Shader) and connect it to the second Shader input socket of the Mix Shader3 node.
  7. Go to the Add Shader node, and in the first Shader slot, select the last Mix Shader node. Label it as Mix Shader4. In the second Shader slot, select a Translucent BSDF shader node.
  8. Connect the output of the Diffuse BSDF node to the first Shader input socket of the Mix Shader4 node, and the output of the Translucent BSDF node to the second Shader input socket.
  9. Set the Diffuse BSDF shader node's Color values for R to 0.031, G to 0.800, and B to 0.000; the Glossy BSDF shader node's Color values for R to 0.646, G to 0.800, and B to 0.267; and the Translucent BSDF shader node's Color values for R to 0.800, G to 0.086, and B to 0.317.
  10. Add a Voronoi Texture node (press Shift + A and navigate to Texture | Voronoi Texture) and a Bump node (press Shift + A and navigate to Vector | Bump). Connect the Color output of the Voronoi Texture node to the Height input socket of the Bump node and the Normal output of this node to the Normal input sockets of the Diffuse BSDF, Glossy BSDF, and Translucent BSDF nodes. Set the Voronoi Texture node's Scale value to 32.600 and the Bump node's Strength value to 0.100. Then enable the Invert item in the Bump node.
  11. Add a Light Path node (press Shift + A and navigate to Input | Light Path) and a Math node (press Shift + A and navigate to Converter | Math). Set the Math node's Operation to Multiply. Connect the Ray Length output of the Light Path node to the first Value input socket of the Math node. Then set the second Value input socket to -8.000.
  12. Press Shift + D to duplicate the Math node. Set Operation to Power. Connect the output of the Multiply math node to the first Value input socket of this node. Set the second Value input socket to 3.000. Enable the Clamp item.
  13. Press Shift + D to duplicate the Power-Math node, set Operation to Add, and connect the output of the Power node to its first Value input socket. Connect its output to the Fac input socket of the Mix Shader4 node.
  14. Connect the Fac output of the Voronoi Texture node to the second Value input socket of the Add-Math node.
    How to do it...

    The completed network of the material

  15. Save the file.

How it works...

In this recipe, we used the Ray Length output of the Light Path node to drive the amount of translucency on the mesh. Ray Length does exactly what its name suggests. It returns the length of a light ray passing through an object. So basically, it is possible for Cycles to know the thickness of a mesh. On the thicker parts, the translucency will show less or even for nothing, whereas it will be more visible on the thinner parts of the mesh.

Note

Note that in the shader network, the Ray Length output was intensified by a set of Math nodes and added to the Voronoi Texture node's output. Then it was connected to the factor input of the Mix Shader node to drive the blending of the Diffuse and of the Translucent components.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.221.112