1
\$\begingroup\$

I created an empty Shader Graph by clicking Create -> Shaders -> PBR Graph.

I created the material for this shader and assigned it to my game object, but the object does not cast a shadow.

If I assign the default LWRP Lit material, then everything works and the shadows are dropped, but with a custom shader there is no shadow.

How can I make my custom shader material cast shadows?

\$\endgroup\$
2
  • \$\begingroup\$ I have not been able to reproduce the issue you describe. Creating a new PBR shader graph, leaving it unchanged, and assigning it to objects in my scene has not interfered with their shadows. A similar question on UnityAnswers suggests that this might be a bug you can resolve by deleting & recreating your lightweight render pipeline asset. Have you tried this? \$\endgroup\$
    – DMGregory
    Commented May 25, 2019 at 21:50
  • \$\begingroup\$ forum.unity.com/threads/… Hi, More information about this \$\endgroup\$ Commented May 27, 2019 at 11:05

1 Answer 1

1
\$\begingroup\$

This fixed it for me:

If you use a transparent surface type on standard LWRP or UniversalRP (that does not cast shadows), then change that material to a custom shadergraph's shader, you lose shadow casting. Just use a lit shader for the new pipelines, set it to Opaque, then change it to your custom shader.

e.g. set it to Lit (universal Render Pipeline/Lit)
enter image description here
and change it back to your custom shader afterwards

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .