Blitz3D+ Command Reference

EntityDitherFade entity[,coverage#][,seed]

Parameters

entity - model whose surfaces are dithered away

coverage# (optional) - share of the surface kept, clamped to 0-1; 1 preserves it exactly (default), 0 removes it completely

seed (optional) - dither pattern seed; 0 derives a stable pattern from the entity's lifetime (default), an explicit nonzero integer gives repeatable matching patterns

Description

Gradually removes tiny pieces of an entity's visible surface.

Use it to fade streamed props or scenery while keeping the remaining pieces in the normal opaque depth and shadow passes. Coverage is clamped to 0-1: 1 preserves the surface exactly; 0 removes it completely. Non-finite values are errors.

Seed 0 derives a stable pattern from the entity's lifetime. An explicit nonzero integer gives repeatable matching patterns to different entities. CopyEntity copies coverage and explicit seeds, while a default seed becomes the copy's own pattern. The operation affects this model's surfaces; apply it separately to mesh children.

This is independent of EntityColor, EntityAlpha, EntityFX and EntityBlend. Existing transparency keeps its meaning. EntityDitherRange multiplies this manual coverage; clearing the distance range does not clear manual coverage. The pattern is visibly grainy without temporal antialiasing, especially during movement. It is not a smooth alpha dissolve and does not alter collision or picking.

Classic materials and compatible built-ins, including Standard, Unlit, Toon, Rim Light, Dissolve, Foliage, Parallax, Wet Surface, Snow, Triplanar, UV Flow, Matcap and Hologram support coverage. Existing material shadow and transparency restrictions still apply. Supported skinned surfaces work too. Custom shaders require the explicit material-operations 2 coverage hooks; using active dither on an unsupported material reports an error. Line lists are not surface models.

Requires Extended mode.

See also: EntityDitherRange, EntityAutoFade, EntityLODTransition, AddEntityLOD.

Example

; Extended mode: Space fades a rotating prop out and back in.
Graphics3D 800,600,0,2:SetBuffer BackBuffer()
camera=CreateCamera():PositionEntity camera,0,1,-5
light=CreateLight():RotateEntity light,35,-25,0
prop=CreateCylinder(12):ScaleEntity prop,.7,1.3,.7:EntityColor prop,45,140,180
coverage#=1:target#=1:lastTime=MilliSecs()
While Not KeyHit(1)
    now=MilliSecs():elapsed#=Float(now-lastTime)/1000:lastTime=now
    If KeyHit(57) Then target=1-target
    If coverage<target Then coverage=coverage+elapsed:If coverage>target Then coverage=target
    If coverage>target Then coverage=coverage-elapsed:If coverage<target Then coverage=target
    EntityDitherFade prop,coverage
    TurnEntity prop,0,elapsed*30,0:RenderWorld
    Color 255,255,255:Text 12,12,"Space: fade | Esc: exit"
    Flip
Wend
End

Index