Dither the present pass #119
No reviewers
Labels
No labels
animation
audio
blocked
bug report
controversial
documentation
easy
feature request
hard
medium
multiplayer
physics
ui
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
elsie/liuverse!119
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/77-present-dither"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The swapchain is 8 bits, so the smooth night gradients -- the sky, the fog
falloff, the flashlight cone -- band in it. The present pass now adds
interleaved gradient noise to the tone-mapped color before the sRGB encode.
The amplitude is divided by the slope of the sRGB curve, so the noise lands
half an LSB away in the output at every brightness. A fixed amplitude in
linear light would be stretched about twentyfold by the curve in the darks,
which is exactly where the banding hurts most.
The noise hashes the pixel coordinate, so it does not crawl between frames.
The moon and the HUD are drawn after the blit, so they stay grain-free.
closes #77
How to test
Run the client at night and look at a smooth gradient -- the sky, the fog
falloff, the flashlight cone. The concentric bands become a faint static
grain instead. A native build is the easiest A/B: revert the commit and the
bands come back.
The web build is where it shows best: on WebGPU the swapchain quantization is
the only banding left and it nearly disappears.
Known limit
On GL and WebGL2 the HDR target is
Rgba8Unorm, so the night gradient isalready quantized in linear light before the present pass sees it, and a
present-pass dither cannot undo that. Fixing it needs a dither on the HDR
write, which this issue scoped out.
A 👍 reaction on this pull request flags it for merge.