Sprite shadows

From ZDoom Wiki
Jump to navigation Jump to search
Circle gzdoom.png Warning: This feature is GZDoom specific, and is not compatible with ZDoom!
To see all of GZDoom's specific features, see GZDoom features.


An example of sprite shadows being cast by an Imp, a floating skull (Using CASTSPRITESHADOW.), and a player.

Sprite shadows are a GZDoom-specific feature added in GZDoom 4.6.0 that allows actors to cast shadows similar to Build engine games such as Duke Nukem 3D. They work by creating a copy of the actors' sprite that is set to the Stencil render style, made black, set to an alpha of 0.5, and crushed to 15% the Y scale of the original sprite, then drawn behind all other actor sprites. Sprite shadows can also fade based on how far off the ground the actor is(New from 4.11.0).

Options

GZDoom has 2 options related to sprite shadows, the first option is r_actorspriteshadow, which can be found in the Display options under the name "Sprite shadows", it has 3 modes:

Default

Sprite shadows are only drawn on actors that explicitly have the CASTSPRITESHADOW flag on.

Monsters and players

Sprite shadows are drawn on monsters (Any actor with the ISMONSTER flag.), and on players. NOSPRITESHADOW can be used to prevent monsters from casting a shadow, but won't work on player classes.

Off

Sprite shadows are not drawn regardless of the actor flags.


There also exist the following CVARs, which are not exposed to the options menu, and have to be changed through the console.

  • r_actorspriteshadowdist: Controls how far (In map units.) from the camera shadows should be drawn, the default value is 1500.
  • r_actorspriteshadowalpha: The base alpha of the sprite shadows, default is 0.5. 1.0 is fully opaque. (New from 4.11.0)
  • r_actorspriteshadowfadeheight: The height above the ground where actor shadows fully fade off. Default is 0, meaning that shadows don't fade with distance off the ground at all. (New from 4.11.0)

Flags

GZDoom has 2 flags pertaining to sprite shadows.

  • CASTSPRITESHADOW
Makes the actor cast a sprite shadow if the option is set to Default, or set to Monsters and players, but the actor isn't either of those.
  • NOSPRITESHADOW
Prevents the actor from casting a sprite shadow regardless of the option.