ToneMapMode [mode]

Parameters

mode (optional) - tone-map curve
0: compatibility clamp
1: Reinhard
2: ACES-style filmic (default)
3: neutral

Description

Chooses the curve that converts HDR scene colours for your display.

When HDRRendering is on, scene brightness can go far above white and something has to map it back to what a monitor can show. That something is this curve. Compatibility clamp simply cuts values off at white - flat and harsh, but handy for side-by-side comparisons and debugging. Reinhard rolls brightness off gently with a broad soft shoulder. ACES-style filmic, the default, adds the punchy cinematic shoulder and contrast most games want. Neutral desaturates the least and keeps hues truthful, which suits stylised palettes and UI-heavy scenes.

The setting only has a visible effect while HDR rendering is enabled, but the value is remembered either way, so you can set it up front. Values above 3 are clamped to 3.

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


See also: HDRRendering, ToneMapExposure.

Example

; ToneMapMode Example
; -------------------

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

; Tone mapping only applies while HDR rendering is enabled
HDRRendering True

; 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

; Saturated orbiting gems show how each curve treats bright colour
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

mode=2

While Not KeyDown(1)

    ; Keys 0-3 select the tone-map curve
    If KeyHit(11) Then mode=0
    If KeyHit(2) Then mode=1
    If KeyHit(3) Then mode=2
    If KeyHit(4) Then mode=3

    ; Select the output curve used for HDR tone mapping
    ToneMapMode mode

    If mode=0 Then label$="compatibility clamp - harsh clipping"
    If mode=1 Then label="Reinhard - broad soft shoulder"
    If mode=2 Then label="ACES filmic (default) - cinematic"
    If mode=3 Then label="neutral - preserves hue and contrast"

    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,"0-3: tone-map curve   Arrow keys: move camera   Esc: exit"
    Text 0,20,"ToneMapMode "+mode+"   ("+label+")"

    Flip

Wend

End

Index