Sprite Shadows

Hi… is there a way (or a best/preferred way) to set up animated sprites so that they’re able to cast real time shadows?

I’ve been attempting to use the attached shadergraph based on this tutorial: Sprite Shadows in Unity - Cast and receive shadows using a SpriteRenderer (https://youtu.be/d_OBjV7c1CY).

I created a quick test project so I could take screenshots to show you what I’m seeing. The shadow appears in the Unity scene window but not when the project is played in the browser.

I’ve probably just got something set up wrong :thinking: … but I wanted to check-in here first to see if this sort of thing is supported before I carry on banging my head against a wall :sweat_smile:

Thanks in advance for any help :slightly_smiling_face:




Sprite_Shadow.shadergraph

Original Post on Discord

by user 908977119781060648

Hi Frannie,

Custom shaders (so shadergraph shaders) in needle only support unlit right now meaning lights and shadows dont affect them

Sprites are currently always without shadows but we can add an extra option for it like with regular renderers where you can just enable shadow casting (without the need of an extra shader).
Would that help you?

Oooooooo! Yes please! That sounds fab!!!

There’s absolutely no rush. Just ‘whenever you have the time’ is fine by me :blush:

THANK YOU!!!

by user 908977119781060648

Note that shadow casting will work but not shadow receiving. And unfortunately the shadow color can still not be controlled
20230521-134431_Sidescroller_-_Google_Chrome-logo.mp4

20230521-135259_Sidescroller_-_Google_Chrome-logo.mp4

will be in the next update
20230521-135330_Needle_Engine_Samples_2020_3_-Sidescroller-PC-logo.mp4

Wow! I genuinely cannot thank you enough for this, @marwie1 :cactus:. It looks*** utterly BRILLIANT*** :eyes: :sparkles: :sparkles: :rocket:

BTW, do you dudes ever take any time off? :sweat_smile: Y’know, for stuff like… sleeping… or eating… :sweat_smile: Seriously though, the colossal amount of work that you put into all this is downright inspiring, it really is.

As ever, cheeeeeeeeeeeeeeeers for everything! :star_struck:

by user 908977119781060648

@marwie1 :cactus: @herbst​:cactus: … I’ve just this minute tried the new Sprite Renderer Data Script included in the latest Needle update and IT IS FABULOUS!!! :raised_hands: :sparkles: :green_heart: :smiling_face_with_three_hearts: :partying_face: :rocket:

It works like an absolute DREAM! Thank you so very much for this!

by user 908977119781060648

Great to hear!