Blob shadow with Decal in URP Unity

Prasetio Nugroho
3 min readMay 26, 2024

--

Sometimes there are many effective ways to display blob shadows. One way that can be used is to use decals. Unity already prepares component decal when using URP as render pipeline. If you want more info to setup urp project you can see unity documentation about URP.

Using decals in Unity’s Universal Render Pipeline (URP) involves a few steps to set up properly. Just make sure you have already install urp package and shader graph package

Create and Configure a Decal Shader

URP comes with a Decal Shader Graph template which can be used to create a decal shader.

Create a Decal Shader. Right-click in the Project Window and select `Create -> Shader -> Universal Render Pipeline -> Decal Shader Graph`. Name your shader (e.g., “DecalShader”).

DecalShader created with shader graph

Double-click on the created Decal Shader Graph to open it in the Shader Graph Editor. Add some Sample texture nodes like this images below

decal shader graph

Save and close the Shader Graph.

Create a Decal Material

  1. Right-click in the Project Window and select `Create -> Material`.
  2. Name the material (e.g., “DecalMaterial”).
  3. Assign Shader to Material. Select new material and in the Inspector, change the Shader to the Decal Shader you created earlier.
  4. Assign texture in the material.
decal material

Use Decal Projector

URP includes a Decal Projector component which is used to project decals onto surfaces.

Create a new empty GameObject. Add a Decal Projector component to it (`Component -> Rendering -> Decal Projector`). In my case I added it as a child.

decal projector component

Don’t forget to add Decal Renderer Feature in URP render setting

decal renderer feature

In the Inspector, assign the Decal Material you created to the `Material` field of the Decal Projector. Adjust the size, offset, and other properties of the Decal Projector.

Don’t forget to rotate with the top direction pointing downwards. Transform rotate Vector3(90,0,0)

decal result

final result in my github repo: https://github.com/prasetion/UnityDecal

Resource

Decal Renderer Component ~ https://docs.unity3d.com/Packages/com.unity.render-pipelines.universal@12.0/manual/renderer-feature-decal.html

--

--

Prasetio Nugroho
Prasetio Nugroho

Written by Prasetio Nugroho

Interested in new tech, gaming, programming and another knowledge or possibilites that can make me better. Cheers!!

No responses yet