antiAliasing.package
- ..
- README.md2.7 KB
- bindings.yaml366 B
- shader.wgsl3.9 KB
This package holds more than this page lists. See all of its files in its world.
README.md
stable_depth
The scene depth a temporal reconstruction restates for the passes after it. Each render's projection samples a different point inside every pixel, so the raster's depth moves under a still camera by up to half a pixel from one render to the next while the reconstructed picture holds still. An effect after the reconstruction that draws from depth (an outline, a pattern laid on surfaces) would move with the raster and not with the picture.
For every pixel this keeps one real depth sample: the one taken nearest the pixel centre since the pixel last changed. A pixel keeps its sample while no surface in its 3x3 neighbourhood moves on screen and the sample still lies between the nearest and farthest depths that neighbourhood holds now; anything else (a moving surface, a disocclusion, a view with no history) takes this render's sample. Over one pass through the offsets a still pixel settles on the sample nearest its centre and keeps it, so the depth is the same on every frame of a still view.
Bindings
| name | kind |
|---|---|
scene_depth | texture_depth |
scene_motion | texture2d |
stable_history | texture2d |
stable_state | buffer |
stable_offset | buffer |
stable_out | storage2d (rg32f) |
stable_state is the history target's state buffer, written by the engine
before each render of a view: x whether stable_history holds that view's
previous result. A render of the view that ran without the pass (a frame with
nothing reading the depth, a cut, a change of size) leaves it 0, so the first
render with the pass again takes its own sample everywhere. stable_offset
carries the render's sub-pixel offset in pixels in zw. When the engine moves
the projection (renderer.setProjectionJitter), every history state it writes
for the render carries that offset, and the writer binds another of its history
targets' states here: a dispatch binds each buffer at one binding. When the
writer moves the projection itself (renderer.setProjectionOffset), it binds a
buffer of its own.
stable_out
holds, per pixel, the kept depth in x and the squared distance of its sample
from the pixel centre, in pixels, in y. The distance is a square, never
negative, so its sign bit says whether this render kept the sample it held
(set) or took its own (clear), which stable_surface follows for the G-buffer
channels. Both words are the ones the render wrote, so the depth is the
raster's to the last bit. A fragment pass restating @scene.depth
(restates = true) hands x back to the frame. Both run on a frame where
something after them reads the depth, or stable_surface reads the kept
sample (whenRead).