Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit7f5b4059ea

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

namekind
scene_depthtexture_depth
scene_motiontexture2d
stable_historytexture2d
stable_statebuffer
stable_outstorage2d (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.