Skip to content

[Rendering] Unify temporal history and eliminate TSR, SSR, GI, and PT instability #135

Description

@proggeramlug

Parent: #126
Includes engine ticket EN-061 from docs/tickets.md
Related: #56

Problem

Temporal effects multiply both quality and failure modes. Bloom uses temporal reconstruction/history in TAA/TSR, SSR, screen-probe GI, denoising, exposure, and realtime path tracing, but these systems do not yet share one authoritative motion/history contract. Observed symptoms include SSR fireflies in dark interiors, specular trails, disocclusion smearing, widened block artifacts after upscale, and soft defaults.

Outcome

A common temporal contract plus a qualification/fix pass that makes still and moving output stable across camera motion, object motion, disocclusion, lighting changes, resolution changes, and feature toggles.

Common temporal contract

Define and document once:

  • motion-vector convention (current-to-previous or previous-to-current), units, jitter inclusion, clip/NDC Y convention, and validity;
  • current/previous transforms for static, rigid, skinned, particle, and procedural content;
  • camera-cut/teleport detection and explicit reset API;
  • history allocation, resize/render-scale change, exposure domain, and reset rules;
  • disocclusion/depth/normal/material rejection thresholds;
  • reactive/composition masks for transparency, particles, emissive changes, and refraction;
  • per-pixel history confidence/length semantics.

Create debug views for motion, reprojected UV, rejection reason, history length, reactive mask, variance, and clamped history.

Required work

TSR/TAA

  • Validate jitter sequence and projection integration.
  • Use neighborhood statistics/variance clipping in a stable color space.
  • Handle subpixel detail, alpha-test coverage, responsive content, render-scale changes, and sharpening without excessive softness/ringing.
  • Integrate quality presets so Ultra is not silently half-resolution/soft; coordinate with Default render_scale=0.5 + TAA + no sharpening makes output blurry #56.

SSR

  • Implement roughness/BRDF-aware ray eligibility and mip choice.
  • Validate hit thickness against the actual Hi-Z level/footprint used.
  • Clamp or reject firefly radiance using local exposure/luminance statistics without crushing valid bright reflections.
  • Weight SSR against probe/planar/ray-query/environment fallback and confidence.
  • Reproduce EN-061's dim-interior/bright-window case.

GI and PT denoisers

  • Share motion/disocclusion rules where representations match.
  • Bound radiance outliers before they poison temporal/spatial history.
  • Preserve fast lighting changes without persistent lag.
  • Reset/reseed correctly on mode toggles and camera cuts.

Motion corpus

Automate at least:

  • slow pan, subpixel crawl, fast rotation, camera cut, and FOV change;
  • translating/rotating rigid object;
  • skinned animation;
  • alpha-tested foliage/card motion;
  • emissive light turning on/off;
  • dark interior looking at bright exterior;
  • transparent/refractive object motion;
  • dynamic-resolution step and window resize.

Compare sequences, not only final frames. Report temporal SSIM/FLIP, flicker/variance, ghost trail duration, rejection ratio, and stable-frame convergence.

Acceptance criteria

  • The shared convention is documented and unit-tested with known matrices/points, including jitter and Y orientation.
  • All motion-producing paths either write valid motion/reactive data or explicitly opt out with correct history rejection.
  • EN-061 interior SSR case contains no isolated high-luminance fireflies above an approved local threshold and retains valid smooth-metal reflections.
  • Camera cuts, mode toggles, resize, and render-scale changes leave no prior-frame image after the documented reset window.
  • Moving geometry has no persistent (> approved frame count) ghost trail in the corpus.
  • Quality presets define render scale, temporal mode, sharpening, and per-effect history behavior together; default output is not unintentionally soft.
  • PT motion goldens and full quality corpus pass on supported backends.
  • Before/after pass timings and memory for every added history/mask are reported.

Likely files

  • native/shared/src/renderer/postfx_chain.rs, ssr_pass.rs, ssgi_pass.rs, pt_pass.rs, hiz.rs, drs.rs
  • shaders under native/shared/src/renderer/shaders/
  • transform/motion ownership in scene/model/animation code
  • quality APIs in src/core/
  • native/shared/tests/golden_render.rs

Non-goals

  • Adding frame generation.
  • Replacing all temporal systems with one shader.
  • Hiding instability by disabling SSR/TAA globally.

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions