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.