Language:
Page Info
Tags:
Skill Level:
Engine Version:
Related Pages

Using Mesh Decals

Choose your OS:

MeshDecalVsMasked.png

In the following guide, we will enable Dbuffer Decals for our project so that we can take advantage of lighting features for our decal material and we'll create a basic Deferred Decal Material that can be applied to our Static Mesh.

Required Files

In order to follow along with this guide, you will need to download, extract, and then import to UE4 the following FBX and Texture files. If you are unfamiliar with how to do this please check out How to Import Static Meshes Guide and How to Import Texture Guide for more information about how to go about doing this.

Required FBX and Textures Download (Right-Click and Save as...)

Enabling DBuffer Decals for your Project

  1. In the Edit menu, click on Project Settings to view the Unreal Editor options.

    ProjectSettingsMenu.png

  2. Under the Engine heading, select the Rendering section and locate the Lighting category that contains various Lighting options.

  3. Now, you can toggle the DBuffer Decals option to use lighting features with your Deferred Decals.

    EnableDBufferDecal.png

  4. Before you'll be able to use this feature, you'll first need to Restart the Editor.

    RestartTheEditor.png

Creating a Basic Deferred Decal

  1. In the Content Browser, select the Add New button and choose the option for Material to create a new Material. Make sure you give your Material a name that will be easy to locate later. For the purpose of this guide, I have named mine "M_MeshDecal."

    AddNewMaterial.png

  2. Now, select your Material and double-click it to open it. Once the Material Editor opens, start by setting the following attributes in the Details panel so that it can be used as a Deferred Decal.

    • Material Domain: Deferred Decal

    • Blend Mode: Translucent

    • Decal Blend Mode: DBuffer Translucent Color, Normal, Roughness

  3. Next, you'll need to setup your material using the textures in the Required Files section of this page. There are three textures in the .zip file that we will need for this step; a diffuse, mask, and normal texture. Once you've imported these textures, select them from the Content Browser and drag them into the Material Editor Graph.

    MaterialGraph1.png

    Now, plug in the outputs of the Texture Sample nodes into their corresponding inputs on the Main Material node. For the Mask texture,"T_MeshDecalDamage_M", be sure to use the Blue Channel output when plugging into the Opacity Mask input. This will make sure the blue values in the texture are used as the maskfor what should be visible.

    MaterialGraph2.png

  4. Right-click in the Material Graph and type in "Constant" or hold down the "1" key and click in the graph to add a Constant value node. Plug this into your Roughness input and give it a default value of 0.7.

    MaterialGraph3.png

  5. Before finishing up, we'll need a way to control the offset of the decal geometry from the base mesh to prevent or lessen any artifacts that can occur due to depth precision. Add the following nodes to your Material Graph and plug the output of the Multiply node into the World Position Offset input of the Main Material node.

    MaterialGraph4.png

    Once you've done this, you're Material Graph should look similar to this:

  6. With your Deferred Decal Material complete, place the Static Mesh "SM_MeshDecal", which is included in the Required Files .zip, into your level and apply the Material M_MeshDecal to Element 0 of the Static Mesh's Material slots. For the Base Mesh's Material you can assign any material or even just a basic color to Element 1 for the purposes of this demonstration. You should now have something that looks similar to our example below.

End Result

MeshDecal.png

Now that you've set up and seen how to create your own Materials to use with a Mesh Decal, you should be confident in authoring your own assets in your modeling applications and creating your own Materials that take full advantage of lighting for use with Mesh Decals applied.

Tags