Sprite shadows

From ZDoom Wiki
Jump to navigation Jump to search
Graficon.gif 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.

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 exists a r_actorspriteshadowdist CVAR that controls how far (In map units.) from the camera shadows should be drawn, the default value is 1500. It is not exposed to the options however, so it has to be changed through the console.

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.