stable_depth.computeShader
- README.md1.8 KB
- bindings.yaml292 B
- shader.wgsl3.2 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_out | storage2d (rgba32f) |
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, zw the render's sub-pixel offset in pixels. stable_out
holds, per pixel, the kept depth in x, the squared distance of its sample
from the pixel centre, in pixels, in y, and in z 1 where this render kept
the sample it held and 0 where it took its own, which stable_surface follows
for the G-buffer channels. A fragment pass restating @scene.depth
(restates = true) hands x back to the frame.