Skip to content

Sprite Depth Fade

Narta Xaymar Dirks edited this page Oct 29, 2026 · 2 revisions

Sprite depth fade (soft edges)

Sprites are flat squares, so where one is partly inside a wall or the ground the sprite is cut off along a hard line. SpriteDepthFade fades the sprite over a distance given in world units. On the GPU the renderer first draws everything solid, then the sprites with the depth buffer of the solid things readable by the sprite shader: the difference between the distance of the sprite and the distance of the solid surface behind it, divided by the depth fade distance and limited to 0 to 1, is multiplied into the alpha of the sprite. Solid sprites are part of that depth, see-through ones are not. The depth is not copied, the same buffer is both the depth test and the image that is sampled, which is why this only costs something for scenes that use the command (one extra pass boundary and one depth texture read per pixel of those sprites).

The same applies to every other entity that is drawn see-through (water, glass, light cones, ghosts): EntityDepthFade sets the distance for any entity, and SpriteDepthFade is the same command for sprites. Each draw reads its own distance, so entities in one scene can have different distances, or none.

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally