#How to do 2d dropdown shadows like this?

9 messages · Page 1 of 1 (latest)

sage stream
#

The game "Mario Maker" has shadows in the 2D worlds so you can tell the background apart (provided screenshot.) The shadows are transparent and above the background but behind all of the sprites.

Mario Maker uses shaders for their shadows, but in godot 4 we have the CanvasGroup node where all of the nodes are drawn as one.

My idea was to make a script that clones the object, changes it's position, then reparents it to the CanvasGroup node that has a modulate effect to make it look like a shadow.

My concern is that you would have to do this every single frame, and do it with up to hundreds of sprites on the screen at once. I don't know if the system can handle that. Any tips?

I added the "Shaders" tag just in case anybody knows how to do this with shaders (You don't gotta provide any specific code, just list the steps)

noble drift
sage stream
#

It just created some transparent black pixels around the corners of my sprite

#

Or I think it's because shaders can't go outside of the sprite, what do I attach the shader to?

noble drift
#

I ve tried it on version 3.5 and worked. Idk about 4.0

bold pebble
#

@sage stream Why not just have a system to duplicate the node (referencing the same texture resource), parent it to the main visual, set the z-offset to -1 , change the position to be what you want, and then self_modulate to black and adjust the alpha to be how strong you want the shadow.

#

I dont think there is any need for a custom shader.

sage stream