Using Subsurface Scattering in Your Materials

Guide for using the Sub-Surface Scattering shading model in your Materials.

Choose your operating system:

Windows

macOS

Linux

Subsurface scattering is the term used to describe the lighting phenomenon where light scatters as it passes through a translucent / semi translucent surface. Unreal Engine 4 (UE4) offers a special Shading Model called Subsurface that is used specifically for materials that need this interaction like skin or wax. The following How To guide will walk you through all you need to know about how to use Subsurface scattering in your Materials.

Enabling the Subsurface Shading Model

Enabling a Material to use the Subsurface shading model can be done a few steps.

  1. First create a new Material by Right-Clicking in the Content Browser and then selecting Material from the Create Basic Asset list. Once created, make sure that you name the Material. For this example, the Material will be named MAT_Subsurface_00 . When completed, your Content Browser should look like this.

    SSM_Create_New_Material.png

  2. Next, open up the Material by Double-Clicking on it with the Left Mouse Button .

    SSM_Open_New_Material.png

  3. Now with the Material open, we need to change the Material's Shading Model from Default Lit to Subsurface .

  4. The Material is now ready to be used as a Subsurface Material.

Setting up a Subsurface Material

Continuing with our Material from above that has Subsurface Scattering enabled, let's setup a basic Material so that we can see the Subsurface scattering in action in a level.

  1. We need to place down some Material Expression nodes so that we have something to work with. For this example, we are going to be adding the following nodes.

    • Vector Parameter x 2

    • Scalar Parameter x 2

    SSM_Adding_Nodes.png

    The reason that we are using Parameter Material nodes instead of regular Material nodes is so that we can make a Material Instance out of this Material for easier tweaking inside the editor.

  2. Before we start to connect the nodes, we first need to name them as well as set default values for them. The names and default values for the nodes are as follows.

    SSM_Named_Nodes.png

    Property Name

    Value

    Base_Color

    r:1.0, g:1.0, b:1.0

    Roughness

    0.35

    Subsurface _Amount

    0.5

    Subsurface_Color

    r:1.0, b:0, g:0

  3. Once the Material Nodes have been named and filled in with the correct data, it is then time to connect the Material nodes to the Main Material Node. To wire a node to the main Material node, use the Left Mouse Button to click on the White Circle that is on the Right Side of the node. With the Left Mouse Button still held down, drag to the Right and the connection wire will appear. Keep dragging to the Right with the Left Mouse Button still held until you come to the input you want to use on the Main Material node. Once your mouse is over the input you want to use, release the Left Mouse Button to connect.

  4. Now that all the nodes have been connected, make sure that you compile the Material by pressing the Apply button. Once compiled, you should have something that looks like this.

    SSM_Finshed_Material.png

  5. Once the Material has been compiled, you can now close the Material window. Then inside of the Content Browser , select the Material, Right-Click on it, and then select the Create Material Instance option from the menu.

Applying a Subsurface Material

  1. Now that the Material Instance has been created, it is now time to test out our new Material. To do this, we first need to create a new blank level to work in by going to the main menu and under the File option select New Level . When prompted what type of level to select, select the Empty Level .

  2. With the new level created, we need to now add some lights so that we can test how our Subsurface Material will look. The first light that we are going to add is a Point Light . To add a Point Light to the scene, we first need to find the Point Light which is in the Modes menu under the Lights option. Once the Point Light is located, you can add one to the screen by first selecting it with the Left Mouse Button and then with the Left Mouse Button still held down dragging the Point Light into the scene and releasing the Left Mouse Button to add it. Once added to the scene, select the light by clicking on it with the Left Mouse Button . Then enter the following values.

    Property Name

    Value

    Location:

    X:230, Y: -67, Z:79

    Intensity:

    128

    Next we are going to add a Spotlight . The Spotlight is located just under the Point Light in the Lights section of the Modes panel. You can add a Spotlight to the screen just like a Point light. Once the Spotlight has been added, enter the following values.

    Property Name

    Value

    Location:

    X:-320, Y: 100, Z:-270

    Rotation:

    X:0, Y:50, Z:0

    Intensity:

    39764

    When completed, you should have something that looks like the following.

  3. With all of the lights added, we can now add a Static Mesh to test with. For this example, we will be using the following mesh.

    StaticMesh'/Game/StarterContent/Props/SM_Chair.SM_Chair'

    If you cannot find the SM_Chair mesh, it is probably because you did not include the Starter Content with your project. To find more about the Starter Content, please check out the Starter Content documentation page.

    Once you have located the mesh, Drag and Drop it from the Content Browser into the level. Once it is in the level, set its location to 0,0,0 in the world. When completed, your level viewport should look like this.

    SSM_Adding_Meshes.png

  4. Now that the Static Mesh has been placed in the level, we can now apply our Subsurface Material to it. To do this, first find the Subsurface Material in the Content Browser . Once the Material has been located, Drag it from the Content Browser on to the mesh to apply it.

Working with the Subsurface Material

Now that the Subsurface Material has been applied, it is time to tweak the settings of the Material Instance. In the following sections, we will go over how we can control how our Subsurface Material will look and how to tweak the various options in the Material Instance to get the results that we want.

Opacity Controls

In the current setup of our Subsurface Material, the Opacity input controls the amount of light that we want our object to scatter. A setting of 0 will allow all light to scatter where a setting of 1 will let no light scatter. The following example shows the back of the chair mesh with the Opacity value set at 0 in the image on the left, 0.5 in the middle image and 1.0 in the image on the right. Notice as the numbers go from 0 to 1, the amount of light we see passing through the object becomes less and less. SSM_Different_Opacity_Settings.png

While the Opacity does help to get rid of a lot of the scattered light, you might notice that there is still some Subsurface scattering happening. To get completely rid of the effect, you are also going to have to adjust the Value of the Subsurface Color (More on this in the Subsurface Color Value section below.)

Subsurface Color Value

While you can adjust the amount of Subsurface scattering that happens via the Opacity input, you can also adjust this using the Value slider in the Color Picker . For example, setting the Opacity to a value of 1.0 and setting the Subsurface Colors Value from White to Black will effectively turn off Subsurface Scattering like in the example below. SSM_Color_Value_Example_00.png

If you do the opposite of this, adjusting the Value slider in the Color Picker so that it is now in the White, you will re-enable Subsurface Scattering like in the example below. SSM_Color_Value_Example_01.png

Here is an example of adjusting the value in real time. Notice how as the Value of the color is adjusted from Red to Black, the amount of Subsurface scattering influence is affected.

Using a Texture as a Subsurface Influence Mask

You can use a Texture as a Mask to have more control over what areas receive or do not receive Subsurface scattering. To do this, all you need to do is plug the Texture you want to use as the Mask into the Opacity Channel of your Material. In the following example, not only are we using a Mask texture, we are also using a Scalar value to control the intensity of the Mask so that we can have more control over the amount of Subsurface scattering that is happening.

SSM_Masked_Texture.png

Mask textures work based on values going from Black to White. Values that are closer to Black will allow the Subsurface effect to come through while values that are closer to White will not allow the Subsurface effect to come through.

Here is what the Material above, using the Mask Texture, looks like in the level. Notice the Black spots on the chair. Those Black spots are the result of using a pure white value in the Mask Texture.

SSM_Masked_Texture_Result.png

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss