Skip to content

EntityCrossFade

Narta Xaymar Dirks edited this page Dec 3, 2026 · 1 revision

EntityCrossFade BlitzLLVM

EntityCrossFade:Void first:Int32, second:Int32, t:Float32
Parameter Mode Type Default Description
first In Int32 required The entity that goes: it keeps the pixels whose threshold is t or more.
second In Int32 required The entity that comes, or 0 to end the link of first.
t In Float32 required How far the crossfade is, from 0 (only first) to 1 (only second).

Description

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

Crossfades between two entities with a dither pattern, so that both stay solid while one replaces the other. This is a BlitzLLVM extension.

Swapping a model for a simpler one at a distance (a tree for its impostor, a detailed mesh for a coarse one) either pops, or both are faded with EntityAlpha or EntityAutoFade, which makes both see-through: they are sorted and drawn without writing depth, and the background shows through where they overlap. EntityCrossFade links the two entities instead and gives them complementary parts of one 4 by 4 pattern on the screen: the first keeps the pixels whose threshold is t or more, the second the others. Every pixel that they both cover is drawn by exactly one of them, so there are no holes and nothing is drawn twice, and both stay solid, with depth and with the speed of solid entities.

The program sets t, by time or by distance, each frame it changes. At t 0 or less only the first entity is drawn, at 1 or more only the second; the other one is skipped as if it were hidden, while the link stays. A second entity of 0 ends the link of the first, and both are drawn as usual again. An entity is in one link at a time: linking it again ends its old link. Freeing either one ends the link too. The link counts for the children of the entities, so a model from LoadAnimMesh is faded whole when its top entity is linked.

Only drawing changes: collisions, picking and EntityInView see both entities as usual. See-through entities (alpha below 1, or textures with alpha and without the mask flag) are crossfaded the same way on top of their own transparency. The pattern stays in place on the screen; with nothing else to smooth it, it shows as a fine grid while t is between 0 and 1, which is least visible when the swap is quick or far away.

Differences

  • Not in the original.

Examples

; The tree becomes its impostor between 80 and 100 units away from the camera.
d# = EntityDistance(camera, tree)
EntityCrossFade tree, impostor, (d - 80) / 20

Related Commands

EntityAlpha Blitz3D, EntityAutoFade Blitz3D, EntityBlend Blitz3D, EntityClass Blitz3D, EntityColor Blitz3D, EntityDepthFade BlitzLLVM, EntityDistance Blitz3D, EntityFX Blitz3D

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally