Godot Version
Godot 4.4
Question
Hi everyone,
I’m currently working on a 2D isometric game in Godot and facing challenges with shadows and Y-sorting. Specifically:
Y-Sorting for Shadows:
The shadows in my game don’t respect the Y-sorting of objects. For example, when an object moves behind another, its shadow doesn’t behave correctly and overlaps in ways that break the visual consistency. I’ve enabled Y-sorting in the TileMap and other nodes, but shadows seem to ignore this setting. Does anyone know how to make shadows respect Y-sorting properly?
Object Height for Shadows:
I want certain objects to have a “height” property so that their shadows are projected correctly with perspective, rather than appearing flat or extending infinitely. For example, if a tall object like a pillar casts a shadow, I want the shadow to reflect the object’s height and adjust dynamically based on the light source’s position. Is there a way to define height for objects and use it in a shader or another solution?
I’ve read about using shaders with heightmaps or manipulating shadow offsets (e.g., SHADOW_VERTEX in fragment shaders), but I’m not sure how to implement this effectively in an isometric setup. Any advice or examples would be greatly appreciated!
Thanks in advance for your help!