Projected ground shadow for 2D sprites
In your harnessGodot shaderMIT
Turn a copy of a sprite into its cast shadow on the ground: the vertex stage flattens and skews it from the sprite's base toward a light direction, and the fragment stage fills it with a shadow colour that fades with distance from the feet.

What it takes and gives
- Shader type
- canvas_item
- Parameters
- shadow_color (vec4 = 0.05, 0.05, 0.1, 0.5), flatten (float = 0.45), skew (float = 1.1), base_v (float = 1), fade (float = 0.6), sway (float = 0)
- Use it on
- A second sprite node with the same texture, placed at the character's position and drawn first.
- Result
- A sprite standing on the ground with a flattened dark shadow stretching to its lower right.
- Renderers
- compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
- Placement
- res://baltor/godot_shaders/sprite_ground_shadow/
Limits. Use a second node with the same texture and this material, drawn before the character (as in the demo). The shadow is a projection of the sprite outline, not lit by Godot's 2D lights, and does not bend over terrain.
Details
- Kind
- Godot shader
- Engine
- Godot 4.3 or later
- Files
- 11 files, 61.6 KB
- Licence
- MIT
- Declared effects
- reads files, runs commands
- Checked with
- Godot 4.7.2, opengl3 compatibility (Mesa llvmpipe, Xvfb)
- Checks
- contract static, engine run, engine log clean, shader in scene, capture written, render not uniform, shader changes pixels
- Techniques
- Planar shadow projection by vertex shear and flattening, Base line recovered from vertex position and UV
- Tags
- godot shader, canvas item, shadow, projected shadow, 2d lighting, vertex animation, sprite
- Identity
library.supply.creative_originals.cf998a07f803dd60356fb73d.2018546acb3cfcec- Version
2018546acb3cfcec74ac8fddcb3ba65a014e4cc7a353704a42f39194611ca7ce
The version is the SHA-256 of the item your harness downloads; every file in it names its own checksum.
Something wrong with this item, its rights or its safety? Report it on the support page, or from your harness after a download.