0
\$\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?

| improve this question | | | | |
\$\endgroup\$
  • \$\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 May 25 '19 at 21:50
  • \$\begingroup\$ forum.unity.com/threads/… Hi, More information about this \$\endgroup\$ – Nikita Goncharuk May 27 '19 at 11:05
0
\$\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.

| improve this answer | | | | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.