0

I tried to render Sprite shadow with the Shader Graph.

But as you can see, the tree is rendered mistakenly before the house.

The tree is rendered before the house

You can see that the tree is actually at the end of these sprites

And here's the Shader Graph that I'm using for my game: Shader Graph

I am totally an amateur in shader and Shader Graph. What's wrong with my shader or is there any way that I could render them correctly?

I tried to set Depth Write to Force Enabled, the occlusion is now correct, but it just hide the UI in Canvas. So I bet it would be a depth buffer problem.

1 Answers1

0

To answer my question: It's not an issue of Shader but an issue of Sort Mode.

Solution

  • Delete URP asset.
  • Set Sort Mode to Default from Project Settings > Graphics.

Reason for the issue

I converted my game from 2D to 3D with URP installed so that the Sort Mode was set to Custom Axis with Vector3(0,1,0). After having installed the URP, the sort mode settings were hidden by URP. And I have switched the Universal Renderer (AKA 3D renderer) so that the settings cannot be modified. It's only applicable to the 2D renderer.