Directional Decal Shader for Environmental Blending In Unity

Directional Decal Shader for Environmental Blending In Unity

When working with assets in Unity projects, I often find that props can feel “out of place” in the environment. To address this, I created a custom decal shader that helps blend props more naturally into the scene.

This shader blends decals onto 3D models based on surface height and world orientation, similar to how snow or sand naturally accumulates on upward-facing surfaces.

  • Unity 2022.3.16f1LTS
  • URP 14.0.9
  • Shader Graph 14.0.9

It supports full material channel blending, including base color, normal map (bump), smoothness, metallic gloss, ambient occlusion and optional emission. Users can fine-tune the decal’s appearance with customizable parameters such as decal albedo texture, decal height and blend strength.

For convenience, the shader uses a packed decal mask texture (R = Metallic, G = Ambient Occlusion, B = Height, A = Smoothness), following the same format as the Mask Map used by Unity’s TerrainLit shader in HDRP and URP. This ensures consistency across assets and streamlines the workflow for developers already using Unity’s terrain systems.

It could work on any objects that may require some top-down decal effect.

Related Posts

Vertex Blend Triplanar Shader In Unity

Vertex Blend Triplanar Shader In Unity

When I first started using Unity, I was not satisfied with how terrain textures were blended together.

Read More
Choppy Wavy Hair In Unity

Choppy Wavy Hair In Unity

I crafted a choppy wavy hair using Blender, adopting a common hair creation workflow often associated with ZBrush.

Read More
Anisotropic Highlight Hair Shader In Unity

Anisotropic Highlight Hair Shader In Unity

Hair models are commonly used in games, but Unity’s default URP materials did not achieve my desired results for hair shading.

Read More