Using a Subsurface Profile in your Materials

The ability to render realistic looking human skin is a must for any modern Video Game engine. To fulfill this need, Unreal Engine 4 (UE4) now offers a shading method specifically for skin or wax like surfaces called Subsurface Profile. While the Subsurface Profile shading model has similar properties to the Subsurface shading model, its key difference is in how it renders. SubsurfaceProfile uses a rendering approach that is based in Screen Space because this helps to better display the subtle subsurface effects seen in human skin where backscattering is a secondary effect only seen in few cases like ears for example. The following document will cover what a Subsurface Profile is and how you can use them in your work.

Enabling Materials to use Subsurface Profiles

Enabling your Material to use a Subsurface Profile can be done in the following 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_Profile_00. When completed, your Content Browser should look like this.

    SSP_Create_New_Material.png

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

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

  4. At this time, you can assign a Subsurface Profile by inputting one into the Subsurface Profile section in the Details panel.

    SSP_Apply_SSP.png

  5. Now the Material is ready to be used with a Subsurface Profile.

Creating Subsurface Profiles

Creating Subsurface Profiles is something that can be accomplished in the following steps.

  1. First Right-Click inside of the Content Browser. Then select the Materials & Textures option and select the Subsurface Profile option.

    2.png

  2. Once the Subsurface Profile has been selected and created, you can name it. For this example, we will name our Subsurface Profile SSP_00. Once completed, you should have something that looks like this.

    SSP_Creating_Naming_SSP.png

Creating a Material that uses a Subsurface Profile

Now that the Material and Subsurface Profile have been created, it is now time to fill them in with data. In the following steps, we will be creating a Material and a Material Instance that can make use of a Subsurface Profile.

  1. The first thing that we need to do is to make sure that our Subsurface Material that was created above is open. If you have the Material open, please go on to the next step. If not, to open the Material, first find it in the Content Browser and then Double-Click on it with the Left Mouse Button to open it up. When completed, you should have something like this on your screen.

  2. With the Material open, it is time to place down some Material Expression nodes. For this tutorial, we are going to make use of the following nodes.

    • Vector Parameter x 1

    • Scalar Parameter x 2

    SSP_Material_Nodes.png

  3. Now that we have the Material Expression nodes added to the graph, we now need to name them and fill them in with some default values. For this example, we will be giving the nodes the following names and default values.

    Property Name Value
    Base_Color R: 1.0 G: 1.0 B: 1.0
    Roughness 0.35
    Subsurface_Amount 0.5

    When everything has been filled in, your shader graph should look something like this.

    SSP_Named_Value_Nodes.png

  4. With the Material Expression nodes now setup, it is time to connect all of them 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.

  5. Now that everything is wired up, we can now add our Subsurface Profile to the Material. To do this, first find the Subsurface Profile input in the Material section of the Details panel. Then use the Left Mouse Button to click in the area that says None. When you do, you will see the Subsurface Profile that was created in the previous steps, select this profile by clicking on it.

    If you do not provide a Subsurface profile, a default one will be used. The default one that is used is a close approximation to Caucasian skin.

  6. With the Subsurface Profile applied and the Material expression linked to the main Material node, it is now time to compile the shader and get ready to make a Material Instance out of this Material. When completed with the Material, it should look something like this.

Using a Subsurface Profile in a Material Instance

  1. With the Material now created and compiled, it is now time to make some Material Instances to make tweaking of parameters faster. To make a Material Instance from our Material, first locate the Material in the Content Browser and then Right-Click on it and select the Create Material Instance option. When completed, your Content Browser should look something like this.

    SSP_Create_New_Material_Instance.png

  2. Now that the Material Instance has been created, open it up by using the Left Mouse Button to Double-Click on it in the Content Browser. Once open, you should see something that looks like this.

  3. To change the Subsurface Profile in a Material Instance, first make sure that you enable the Override Subsurface Profile and then provide the Subsurface Profile that you want to use by using the Left Mouse Button to click on the Subsurface Profile input. Once you click on the input you should see the Subsurface Profiles that are available to choose from.

    If you have already supplied a Subsurface Profile in the Master Material, then you do not need to override it in the Material Instance. This is only if you wish you use a different Subsurface Profile than what is already being used.

Applying a Subsurface Profile 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 Start 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.

Adjusting a Subsurface Profile

  1. Once the Material Instance has been applied to the chair, it is now time to adjust the Subsurface Profile settings. To do this, we first need to open up the Subsurface Profile by using the Left Mouse Button and Double-Clicking on the Subsurface Profile inside of the Content Browser to open it up. When you do, you should see something like this being displayed.

    SSP_Subsurface_Profile.png

    You can adjust the properties of the Subsurface Profile by using the Left Mouse Button to click on the property that you want to edit to expose the color picker.

    • Scatter Radius: The distance in world space units to perform the scatter.

    • Subsurface Color: The Subsurface Color can be used as a mask or a weight for the subsurface effect. Black means there is no subsurface scattering. White means all lighting is entering the material and gets scattered around. A non-grayscale value give more control over what color contributions are entering the surface resulting in a more complex looking shading.

    • Falloff Color: The Falloff Color defines the material scattering color once the light has entered the material. You should avoid using a vivid color here if you want to get a more complex shading variation over area you see the scattering.

  2. Keep in mind that you can adjust the parameters of the Subsurface Profile in real time as demonstrated below.

Tips & Tricks

Because of how Subsurface Profiles render, there are a few Tips & Tricks to getting the most out of using them.

Scatter Radius

Setting the Scatter Radius of the Subsurface profile to a really big number will result in rendering errors as you can see in the following image. SSP_Big_Small_Scatter_Radius.png

In the image on the Left, the Scattering Radius has been set to 50. Notice how it looks like there are multiple images rendered on the surface. Now take a look at the image on the Right. In this image the Scatter Radius has been set to 5.0. Notice how the image looks softer and more natural. This is the type of effect we are trying to achieve.

Combining a Material Instance with a Subsurface Profile

Combining a Material Instance with a Subsurface profile is a great way to get the most control over your results for a number of reasons.

  • A Material Instance allows you to tweak values in real time which makes seeing your results much quicker.

  • You can use the Opacity input to dampen the Subsurface contribution to the surface. However it is recommended that you keep this value at 1 and adjust the parameters inside the Subsurface Profile. Only adjust this value if you find that you cannot get the results you are looking for when adjusting the Subsurface Profile.

  • The Value slider of each color picker controls the influence of the Subsurface effect. The closer that this value is set toward white, the more prominent the effect will be. While the closer the value is set to black, the less visible the effect will be.

Tags