1
\$\begingroup\$

I have a gameobject with a SpriteRenderer, and I want it to cast (and receive) shadows like a 3D model. The sprite will turn around depending of his direction, so all faces must cast shadows.

I already activated Cast Shadows and Receive Shadows in the Sprite Renderer component, and also included a Transparent Cutout shader with the Cull Off instruction (so all faces are drawn), but only one side of the sprite is being affected by light, while the other is even darker. To ilustrate:

enter image description here enter image description here

How can I achieve an sprite casting shadows with both faces?

\$\endgroup\$
1
\$\begingroup\$

Use cast shadows as "Two Sided".

enter image description here

You should use a quad with Standard Shader in Cutout and a duplicated and flipped quad for opposite side. They will have mesh rendered in them and auto shadow cast selected. You can turn off Shadow cast for one. That way you are not bound to sprite. You can take advantage of Standard Shader in that case.

\$\endgroup\$
  • \$\begingroup\$ Thank you. Unfortunately, one of the faces is still darker (like is not being affected by light) as in the second image I post in the main question. How can I solve this? \$\endgroup\$ – Gardener Jul 4 '16 at 12:47
0
\$\begingroup\$

So I finally get it to work using the built-in "Sprite/Default" Unity shader with the addition of Fallback "Legacy Shaders/Transparent/Cutout/VertexLit" at the end.

\$\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.