Blob shadow with Decal in URP Unity
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”).
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
Save and close the Shader Graph.
Create a Decal Material
- Right-click in the Project Window and select `Create -> Material`.
- Name the material (e.g., “DecalMaterial”).
- Assign Shader to Material. Select new material and in the Inspector, change the Shader to the Decal Shader you created earlier.
- Assign texture in the 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.
Don’t forget to add Decal Renderer Feature in URP render setting
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)
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