Soft drop shadow inside the sprite rectangle
In your harnessGodot shaderMIT
Add an offset, softened drop shadow behind a sprite's shape without an extra node: the shader samples the alpha at an offset with a small blur and composites the sprite over it.

What it takes and gives
- Shader type
- canvas_item
- Parameters
- shadow_color (vec4 = 0, 0, 0.05, 0.6), offset_x (float = 7), offset_y (float = 7), softness (float = 2.5)
- Use it on
- A Sprite2D (or other textured CanvasItem) with transparent space around its shape, assigned to the node as usual. Effects outside the shape are drawn inside the texture rectangle, so the texture needs a margin.
- Result
- An orange disc floating above the background with a soft dark shadow to its lower right.
- Renderers
- compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
- Placement
- res://baltor/godot_shaders/sprite_drop_shadow/
Limits. Effects outside the shape are drawn inside the texture rectangle, so the texture needs a margin. Offsets larger than the margin are cut at the texture edge. The shadow ignores what lies under the sprite (it is not a light).
Details
- Kind
- Godot shader
- Engine
- Godot 4.3 or later
- Files
- 11 files, 62.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
- Offset alpha sampling with a Gaussian kernel, Porter-Duff over compositing
- Tags
- godot shader, canvas item, drop shadow, shadow, sprite, 2d, ui
- Identity
library.supply.creative_originals.4517798ffe7d8a2e88cdefcc.f074e224bed39fce- Version
f074e224bed39fce139a8605fa199c5fefa5cb7b633c19646d404b4dbb5ca216
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.