Blitz3D+ Command Reference

PlanarReflectionSettings reflection[,scale#][,clip_bias#]

Parameters

reflection - live managed reflection handle

scale# (optional) - fraction of each source viewport dimension, clamped to .25-1; .5 (default)

clip_bias# (optional) - non-negative scene units; negative values clamp to zero; .02 (default)

Description

Sets a reflection's capture resolution and clipping separation.

Values must be finite. Scale .5 uses half the width and half the height: one quarter of the pixels. The target follows camera viewport and presentation-target resizing. It remains single-sample even when the main view uses MSAA.

The plane clips away geometry on its back side. Bias moves the retained boundary slightly toward the front normal, reducing contact artefacts. Too much bias removes nearby reflected detail, so keep it small relative to your game scale. It does not move the receiver or the camera.

Lower resolution reduces pixel work and target memory; scene submission, geometry and reflection shadows still have a cost. Use CaptureFrame to inspect each resident capture's colour/depth allocation, draws, triangles and latest GPU/shadow timing. Timings are recent samples, not a benchmark average.

Requires Extended mode.

See also: CreatePlanarReflection, PlanarReflectionEnabled, EntityPlanarReflection, FreePlanarReflection.

Example

; Extended mode. A finite vertical mirror reflects the moving marker.
Graphics3D 800,600,0,2
SetBuffer BackBuffer()
camera=CreateCamera():PositionEntity camera,3,2.7,-7
light=CreateLight():RotateEntity light,35,-25,0
AmbientLight 65,65,65
plane=CreatePivot():PositionEntity plane,0,1.8,3:RotateEntity plane,-90,0,0
PointEntity camera,plane
mirror=CreateMesh():surface=CreateSurface(mirror)
AddVertex surface,-2,0,-1.5,0,0:AddVertex surface,2,0,-1.5,1,0
AddVertex surface,2,0,1.5,1,1:AddVertex surface,-2,0,1.5,0,1
AddTriangle surface,0,3,1:AddTriangle surface,1,3,2:UpdateNormals mirror
PositionEntity mirror,0,1.8,3:RotateEntity mirror,-90,0,0
material=LoadShader("builtin:planar-reflection")
ShaderColor material,"FallbackColor",35,65,80
EntityShader mirror,material
reflection=CreatePlanarReflection(camera,plane)
EntityPlanarReflection mirror,reflection
marker=CreateCone(16):ScaleEntity marker,.55,1.2,.55:PositionEntity marker,-1.4,1,-4
EntityColor marker,240,160,35
arm=CreateCylinder(12,True,marker):ScaleEntity arm,.12,.9,.12
RotateEntity arm,0,0,90:PositionEntity arm,.7,.4,0:EntityColor arm,50,170,190
floor=CreatePlane():PositionEntity floor,0,-.3,0:EntityColor floor,40,50,65
active=True:scale#=.5
While Not KeyHit(1)
    TurnEntity marker,0,.4,0
    If KeyHit(26) Then scale=scale-.25
    If KeyHit(27) Then scale=scale+.25
    If scale<.25 Then scale=.25
    If scale>1 Then scale=1
    PlanarReflectionSettings reflection,scale,.02
    RenderWorld
    Text 12,12,"[ / ] changes capture scale from .25 to 1; Esc exits"
    Flip
Wend
FreePlanarReflection reflection
FreeShader material
ClearWorld
End

Index