Blitz3D+ Command Reference

Dither enable

Parameters

enable - true to enable hardware dithering, false to disable; true (default)

Description

Enables or disables hardware dithering. A legacy command from the 16-bit colour era.

Hardware dithering was useful when running games in 16-bit colour mode: 16-bit mode offers fewer colours than the eye can distinguish, so bands of colour are noticeable on smoothly shaded objects, and dithering blends the bands to fake extra colours. In 24-bit and 32-bit modes there are more than enough colours and dithering is redundant.

On the modern DirectX 12 renderer this command is accepted for compatibility but has no effect - rendering is always full colour depth, so there is no banding to hide and no dithering hardware to switch. Existing code that calls Dither continues to run unchanged.

See also: AntiAlias, WBuffer, Graphics3D.

Example

; Dither Example
; --------------

; Dithering matters most in 16-bit colour, where smooth shading shows banding
Graphics3D 640,480,16,2
SetBuffer BackBuffer()

camera=CreateCamera()

; Light the sphere from above for the strongest shading gradient
light=CreateLight()
RotateEntity light,90,0,0

; A big smooth sphere - colour banding shows up in its shaded gradient
sphere=CreateSphere(32)
PositionEntity sphere,0,0,2

enable=1

While Not KeyDown(1)

    ; Space toggles hardware dithering
    If KeyHit(57) Then enable=1-enable

    ; Enable or disable hardware dithering
    Dither enable

    TurnEntity sphere,0,0.5,0

    RenderWorld

    Text 0,0,"Space: toggle dithering   Esc: exit"
    If enable Then Text 0,20,"Dither True" Else Text 0,20,"Dither False"
    Text 0,40,"Look for colour banding in the sphere's shading (16-bit modes)"

    Flip

Wend

End

Index