Log inGet started
Package

taau.renderFeature

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

taau.renderFeature

The pass that turns a smaller render into a display-resolution image.

Its passes do three things on every frame drawn:

  1. Move the sample. renderer.setProjectionJitter states a sequence of Halton points inside the pixel, in units of the scene's pixels, which every view walks by its own count of renders — so consecutive renders of a view sample the same continuous image on different grids. The resolve reads where this render sampled from @frame.camera ([13].xy).
  2. Resolve. taau_resolve runs at the head of the display stage, where the frame is already at the display's resolution and the UI has not landed on it yet. It reads the presented colour, the scene's depth and velocity, and the accumulation the view's previous render wrote, and writes this render's.
  3. Composite. A fragment pass puts that accumulation back on the frame.

After the resolve, stable_depth (@builtin::systems.antiAliasing.stable_depth) keeps for every scene pixel the depth sample taken nearest its centre, and a fragment pass whose output is @scene.depth (restates = true) hands it back to the frame, so every pass after the reconstruction reads a depth and a camera with no sub-pixel offset. Those two name @scene.depth and the kept depth in whenRead: on a frame where nothing after them reads the depth (a pass binding @scene.depth or drawing with a shader that samples it, or an effect of the post-process chain that samples it) they are left out, and the first render that has such a reader again starts the kept depth over from its own. A third pass, whose output is @frame.camera (restates = true), restates the camera on every frame, so a pass after the reconstruction that reads the camera and no depth reads it with no sub-pixel offset as well. The resolve reads the raster's own depth ahead of them and keeps neither.

The accumulation is a history target (history = true): the engine keeps one pair of images per view, hands the resolve the previous one to read and the current one to write, and states in the target's state buffer whether the previous one holds that view's last render (it does not on the view's first render, after a cut or after a resize, and the resolve then starts over from the frame alone). It is created with screenSpace = "composite", which is what keeps it at the presented resolution while the scene renders smaller — a scene-space target would follow the scene down and there would be nothing to reconstruct onto.

Sixteen sample points, where an antialiasing accumulation uses eight: reconstructing a display pixel the scene never rasterized takes samples spread over more than one scene pixel.

The feature states its inputs (dependsOn = { "settings", "viewport" } and an inputs function answering the render scale's sample count and the parameter buffers @builtin::systems.temporalUpscale.temporalUpscale hands over), so its render runs when one of them moves and the passes it handed over stand in every other frame.

teardown returns every view's projection to pixel centres and releases its targets.