Simulating Subsurface Scattering in Cycles using the Vertex Color tool
In this recipe, we will create a fake Subsurface Scattering material as shown in the following screenshot, using the Vertex Color tool:
The Rendered result of the vertex color fake SSS material of this recipe
Getting ready
Start Blender and open the 9931OS_07_start.blend file.
Go to the Renderwindow, 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.
Select the Suzanne mesh, click on the Mode button in the Camera view toolbar, and choose Vertex Paint (or just press the V key). Now Suzanne goes into Vertex Paint mode.
Click on the Paint item to the left of the Mode button and select Dirty Vertex Colors. Then press T, and in the last operation subpanel (Dirty Vertex Color) at the bottom of the Tool Shelf panel, set Blur Strength to 0.50, Highlight Angle to 90°, and Dirt Angle to 90°. Enable the Dirt Only item as shown in the following screenshot:
A screenshot of Suzanne in Vertex Paint mode and the Dirty Vertex Color values at the bottom of the Tool Shelf
The Suzanne mesh inside the 9931OS_07_start.blend file already had a Vertex Color layer named Col. With the previous procedure, we overwrote it.
Go to the Object data window under the main Properties panel to see it in the Vertex Colors subpanel. Then go back to Object Mode and press T to get rid of the Tool Shelf panel.
Save the file as 9931OS_07_SSS_vcol.blend.
How to do it...
After the vertex color preparation, let's go for the material itself by following these steps:
Click on the New button in the Node Editor window toolbar or in the Material window under the main Properties panel. Rename the material SSS_vcol.
In the Material window, switch the Diffuse BSDF shader with an Add Shader node. In the first Shader slot, select a Mix Shader node. In the second Shader slot, select a Translucent BSDF shader node. In the Properties side panel to the right of the Node Editor window, label the Mix Shader node as Mix Shader1.
Go to the Mix Shader1 node. In the first Shader slot, select a Diffuse BSDF shader node. In the second Shader slot, select a Glossy BSDF shader node. Set the Glossy BSDF node's Roughness value to 0.450 and Distribution to Beckmann.
Add a Fresnel node (press Shift + A and navigate to Input | Fresnel), connect it to the Fac input socket of the Mix Shader1 node, and set the IOR value to 3.850.
Set the Diffuse BSDF node's Color values for R to 0.031, G to 0.800, and B to 0.000 (the same bright green as in the Simulating Subsurface Scattering in Cycles using the Translucent shader recipe); and the Translucent BSDF node's Color values for R to 0.800, G to 0.086, and B to 0.317 (the same pink as in the Using the Subsurface Scattering shader node recipe). Set the Glossy BSDF node's Color values for R to 0.646, G to 0.800, and B to 0.267, again it's the same yellowish color as in the Using the Subsurface Scattering shader node recipe).
Add a Texture Coordinate node (press Shift + A and navigate to Input | Texture Coordinate), a Mapping node (press Shift + A and navigate to Vector | Mapping), and a Noise Texture node (press Shift + A and navigate to Texture | Noise Texture).
Connect theUV output of the Texture Coordinate node to the Vector input socket of the Mapping node, and the output of this node to the Vector input socket of the Noise Texture node. Set the Noise Texture node's Scale value to 20.000.
Add a Bump node (press Shift + A and navigate to Vector | Bump) and connect the Color output of the Noise Texture node to the Height input socket of the Bump node. Then connect the Normal output of this node to the Normal input sockets of the Diffuse BSDF, Glossy BSDF, and Translucent BSDF nodes.
Add a newMix Shader node (press Shift + A and navigate to Shader | Mix Shader), label it as Mix Shader2, and paste it between the Add Shader and Material Output nodes. Then move the connection from the Add Shader node to the second Shader input socket, and connect the output of the Mix Shader1 node to the first Shader input socket of the Mix Shader2 node.
Add an Attribute node (press Shift + A and navigate to Input | Attribute) and a ColorRamp node (press Shift + A and navigate to Converter | ColorRamp). In the Name slot of the Attribute node, write the vertex color layer name, that is, Col. Then connect the Color output of Attribute node to the Fac input socket of the ColorRamp node. In the ColorRamp node, move the white color stop to 0.350 position.
Add an RGB Curves node (press Shift + A and navigate to Color | RGB Curves) and connect the Color output of the ColorRamp node to the Color input socket of this node. Then connect its Color output to the Fac input socket of the Mix Shader2 node.
Inside the RGB Curves node's interface window, move the first curve control point coordinate values for X to 0.00000 and Y to 0.88125, and the second point coordinate values for X to 1.00000 and Y to 1.00000.
Save the file. The overall network will be as shown in the following screenshot:
The overall network; note the Vertex Color output intensified by ColorRamp and RGB Curves nodes
How it works...
Compared to the former recipe, in this case, we used information about the Vertex Color, enhanced by the ColorRamp node, to drive the mixing of the translucency with the other components of the shader. It's clear that the final result is largely due to vertex painting. We obtained this result quickly through the Dirty Vertex Color tool, but that could also be painted by hands (imagine you're painting a mask for a skull under the face skin).