Language:
Page Info
Engine Version:
Related Pages

Mesh Decals Overview

Choose your OS:

Unreal Engine 4 now has support for Mesh Decals, enabling you to use the properties of Deferred Decals on separate surface geometry for added detail to your Static and Skeletal Meshes. Because Deferred Decals rely on projection, you are limited to mostly planar surface details that shear and distort when not aligned with the surface it’s projecting onto. Mesh Decals afford you decals that do not follow a simple projection and instead can be used with geometry that wraps around edges, being used with spline meshes, ultimately enhancing the look of your characters.

Mesh Decal versus Masked Material

Mesh Decals are a mix of translucent blend mode and deferred decals in that they do not render to depth but do update the GBuffer or DBuffer after the opaque geometry has been rendered. In contrast to using a masked material, there is no cost for EarlyZ pass, you don't get shadows or proper occlusion, but with the trade-off, you get the soft transitions in the material.

Mesh Decals provide several differences to Deferred Decal Actors that you should be aware of:

  • Since large Deferred Decals often do front and back facing draw calls, there are fewer draw calls.

  • Since there are fewer pixels covered and flat back facing decals cover 0 pixels, it's quite faster.

  • Since you can use a custom UV, You have the ability to do more complex projections.

  • You have the ability to have properly normal mapped decals wrapping around surfaces (or stretching along splines).

 Mesh Decal

 Masked Material

Authoring Content

Authoring content for use as Mesh Decal geometry is in line with any model creation. Since this geometry will not rely on projection (like a Deferred Decal Actor), the geometry needs only to stay in front of the surface you want to affect. With this in mind, the decal geometry should "hug" the underlying surface, but it does not have to match it very closely because there is already a small depth bias applied to account for this small offset. Also, using a bit of geometry that feathers out from the decal can be good to create the soft transitions for the decal, which is something you cannot attain with a masked material.

MeshDecalAuthoring.png

MeshDecalAuthoringComposite.png

Base Mesh and Decal Geometry (Isolated)

Composited Mesh

Another thing to keep in mind when developing your content, is that Mesh Decals can be a challenge with Levels of Detail (LOD), or long view distances when there is limited depth buffer precision, because geometry will intersect (or not match-up) as intended. However, you can either change the mesh to account for this (in most cases), or you can use World Position Offset in your material to adjust the offset without having to return to your modeling application.

Offset.png

 Offset Value: 0

 Offset Value: -0.6

In this example, the decal geometry is close enough to the base mesh, such that the depth cannot account for the offset. Using a small negative offset value pushes the geometry out just enough so that it does not intersect with the underlying geometry.

Notes

  • DBuffer and non-DBuffer use the same container.

  • Sort by depth to avoid artifacts when there are many layers overlapping.

  • Parallel Rendering isn't yet hooked up. There are some CPU savings if this feature is used extensively.

Limitations

  • Material Editor Preview is not visible.

  • There is no artist specified sort order.

  • Tangent Space support is not yet implemented.

  • Shader Overdraw/Overdraw functionality is missing.

  • Since it assumes base pass usage, the Material Editor does not currently show the correct instructions count.

  • There is no easily adjustable DepthBias. Currently, you have to use an offset in the mesh from the surface it's above, or control with World Position Offset in the Material.