Skip to content

shadowDrop(spriteTex, uv, shadowOffset?, shadowColor?, shadowAlpha?): Node <"vec4">

Defined in: packages/nodes/src/lighting/shadows.ts:22

Create a drop shadow effect. Samples the sprite’s alpha at an offset position to create shadow.

Texture 

Source sprite texture

Node <"vec2">

Current UV coordinates

Vec2Input = ...

Shadow offset in UV space (default: [0.02, -0.02])

Vec3Input = ...

Shadow color (default: [0, 0, 0])

FloatInput = 0.5

Shadow opacity (default: 0.5)

Node <"vec4">

Shadow color with alpha (vec4), composite with original

// Create shadow behind sprite
const shadow = shadowDrop(texture, uv, [0.03, -0.03], [0, 0, 0], 0.4)
// Mix: show shadow where sprite alpha is 0, original where alpha is 1