Skip to content

EntityDepthFade

Narta Xaymar Dirks edited this page Oct 29, 2026 · 1 revision
BlitzLLVM

EntityDepthFade 〔BlitzLLVM〕

EntityDepthFade:Void entity:Int32, fade_distance:Float32
Parameter Mode Type Default Description
entity In Int32 required The entity.
fade_distance In Float32 required How far in front of a solid surface (world units) the entity is faded out. 0 or less turns the effect off.

Description

〔BlitzLLVM〕 This command does not exist in the original Blitz products. BlitzLLVM adds it.

Fades an entity out where it gets close to something solid behind it, which is what removes the hard line where a see-through mesh (a water surface, a glass pane, a light cone, a ghost, a decal-like quad) cuts into a wall or the ground. This is the same effect as SpriteDepthFade has for sprites, for every entity that is drawn see-through. The entity is faded by the distance in front of the solid surface: at that distance or more it is as it would be without the command, and where it touches the surface it is gone. The distance is in world units (the same as PositionEntity), so a pane with a distance of 2 fades over the last 2 units next to the surface.

A distance close to 0 (or less) turns the effect off, which is the default, and entities without it cost nothing extra. The effect needs the surface to be see-through: it works with EntityAlpha, the alpha of the texture (EntityBlend 1), the alpha of the vertices (EntityFX 32), and with EntityBlend 3 (add). It does nothing for solid or masked surfaces, and with EntityBlend 2 (multiply), which does not look at alpha. Only what was drawn before the see-through things is taken into account: solid meshes, terrain, planes and solid sprites fade the entity, but see-through entities do not, other entities with a depth fade included. It works for perspective and orthographic cameras, and a copy made with CopyEntity has the same distance.

Differences

  • The original has no such command. This is an extension; programs that use it do not compile with the original Blitz3D.

Examples

Graphics3D 320, 240, 0, 2
SetBuffer BackBuffer()
camera = CreateCamera()
CameraClsColor camera, 40, 60, 90
PositionEntity camera, 0, 3, -5
RotateEntity camera, 20, 0, 0
light = CreateLight()
RotateEntity light, 45, 30, 0
floor = CreatePlane()
EntityColor floor, 90, 120, 80

; Two glass panes standing in the ground: the left one with a hard edge, the right one with a depth fade.
For side = 0 To 1
	pane = CreateCube()
	ScaleEntity pane, 1.5, 1.5, 0.05
	EntityColor pane, 200, 230, 255
	EntityAlpha pane, 0.8
	PositionEntity pane, -2.6 + side * 5.2, 0.3, 2
	RotateEntity pane, 0, 60, 0
	If side = 1 Then EntityDepthFade pane, 1
Next
RenderWorld
Flip
WaitKey

Related Commands

EntityAlpha, EntityAutoFade, EntityBlend, EntityClass, EntityColor, EntityDistance, EntityFX, EntityInView

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally