Blitz3D+ Command Reference

HDRRendering [enable]

Parameters

enable (optional) - True switches to HDR rendering, False restores the standard LDR path; True (default). The engine starts with HDR disabled.

Description

Turns high-dynamic-range 3D rendering on or off.

With HDR on, the scene renders into a floating-point buffer where bright lights and emissive surfaces keep values above white instead of clipping at it. One engine-owned output pass then applies exposure and the tone-map curve to produce the final image. The practical wins: bloom feeds on real brightness, hot colours roll off gracefully instead of flattening, and scene-linear camera effects work with honest light values.

The window itself stays 8-bit SDR - this is not HDR10 monitor output - and captured screenshots show the final tone-mapped image. There is no automatic exposure; brightness is yours to control.

Toggling at runtime is safe: the engine rebuilds its presentation-target resources cleanly, so an options-menu switch just works. LDR remains the default so existing games look exactly as before. One interaction to know: with 4x MSAA selected, HDR uses it only if the device supports 4x sampling in the floating-point format - otherwise FXAA is used and a warning is logged.

For the full story, see the image-quality guide.

Requires Extended mode.

See also: ToneMapMode, ToneMapExposure, AntiAliasMode, BrushEmissive.

Example

; HDRRendering Example
; --------------------
; Requires Extended mode.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,0,2,-7
RotateEntity camera,10,0,0

; An overbright sun pushes lit surfaces well above white
sun=CreateLight(1)
RotateEntity sun,45,30,0
LightColor sun,480,440,380

; Ground plane catching the intense light
ground=CreateCube()
ScaleEntity ground,10,0.1,10
PositionEntity ground,0,-0.1,3
EntityColor ground,190,190,200

; A ring of orbiting gems - in LDR their bright sides clip to
; flat white; HDR tone mapping keeps the colour and detail
ring=CreatePivot()
PositionEntity ring,0,1.5,3
For i=0 To 5
    gem=CreateSphere(16)
    ScaleEntity gem,0.7,0.7,0.7
    PositionEntity gem,Cos(i*60)*3,0,Sin(i*60)*3
    EntityColor gem,255-i*25,90+i*25,140
    EntityParent gem,ring
Next

hdr=1

While Not KeyDown(1)

    ; Press Space to switch between HDR and the compatible LDR path
    If KeyHit(57) Then hdr=1-hdr

    ; Toggle high-dynamic-range rendering (rebuilds targets safely)
    HDRRendering hdr

    TurnEntity ring,0,0.7,0

    ; Arrow keys move the camera
    If KeyDown(200) Then MoveEntity camera,0,0,0.1
    If KeyDown(208) Then MoveEntity camera,0,0,-0.1
    If KeyDown(203) Then TurnEntity camera,0,1,0
    If KeyDown(205) Then TurnEntity camera,0,-1,0

    RenderWorld

    Text 0,0,"Space: toggle HDR   Arrow keys: move camera   Esc: exit"
    If hdr
        Text 0,20,"HDRRendering True   (bright light rolls off smoothly)"
    Else
        Text 0,20,"HDRRendering False   (bright light clips to flat white)"
    EndIf

    Flip

Wend

End

Index