Blitz3D+ Command Reference

EntityLODTransition entity[,width#]

Parameters

entity - entity with mesh levels registered by AddEntityLOD

width# (optional) - full transition band in world units, centred on each threshold; must be non-negative; 0 restores hard switching (default)

Description

Crossfades between the mesh levels registered by AddEntityLOD instead of switching hard.

The non-negative width is the full transition band in world units, centred on each existing threshold. Width 0 restores hard switching with the existing 10% hysteresis. Automatic LOD continues to require static, unmorphed meshes.

For a threshold of 20 and width of 4, both meshes are submitted between distances 18 and 22. Their dither patterns divide the covered pixels between them. This keeps matching projected geometry fully covered; different silhouettes can still expose the mesh change. Author lower-detail meshes with similar outlines and matching materials. Both meshes cost rendering work while the transition is active.

The effective width is clamped so neighbouring transition bands never overlap and the first starts at a non-negative distance. Hysteresis remains outside each band, limited by its edges. Each LOD retains its registered brush and geometry; EntityShader and other entity material settings still apply normally. CopyEntity copies the width and LOD table; ClearEntityLODs removes the paired geometry.

Coverage is shared with supported shadows and EntityHighlight. Manual dither and distance fading multiply the pair's coverage without changing its blend mode. RenderSubmittedDraws and RenderTriangles include both submitted representations; RenderLODSelections counts submitted replacement levels. Collision and picking continue to use the base mesh. See EntityDitherFade for supported materials and the visible grain when temporal antialiasing is off.

Requires Extended mode.

See also: AddEntityLOD, ClearEntityLODs, EntityDitherFade, EntityDitherRange, RenderLODSelections.

Example

; Extended mode: two actual mesh representations, with optional dithered switching.
Graphics3D 800,600,0,2:SetBuffer BackBuffer()
camera=CreateCamera():PositionEntity camera,0,1,-5:CameraRange camera,.1,40
light=CreateLight():RotateEntity light,35,-25,0
prop=CreateCylinder(32):low=CreateCylinder(8)
EntityColor prop,60,160,190:ScaleEntity prop,1,1.5,1
AddEntityLOD prop,low,10:FreeEntity low
enabled=True:EntityLODTransition prop,4:lastTime=MilliSecs()
While Not KeyHit(1)
    now=MilliSecs():elapsed#=Float(now-lastTime)/1000:lastTime=now
    MoveEntity camera,0,0,(KeyDown(200)-KeyDown(208))*elapsed*6
    If KeyHit(57)
        enabled=Not enabled
        If enabled Then EntityLODTransition prop,4 Else EntityLODTransition prop,0
    EndIf
    RenderWorld:Color 255,255,255
    Text 12,12,"Up/down: move | Space: transitions "+enabled+" | Esc: exit"
    Text 12,34,"Submitted triangles: "+RenderTriangles()
    Flip
Wend
End

Index