Skip to content

Implement TSAA (Temporal Specular Anti-Aliasing) pipeline#74

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/implement-tsaa-scheme
Draft

Implement TSAA (Temporal Specular Anti-Aliasing) pipeline#74
Copilot wants to merge 3 commits intomainfrom
copilot/implement-tsaa-scheme

Conversation

Copy link

Copilot AI commented Mar 7, 2026

Adds a full temporal anti-aliasing pass to the forward rendering pipeline: Forward → TSAA → PostProcessing → Present.

New files

  • TSAAPass.h/cppFullScreenPass subclass managing two persistent RGBA16F images in ping-pong for history reprojection. Handles resolution changes by recreating buffers.
  • tsaa.hlsl — Per-pixel motion vectors via inv(ViewProj) cofactor inverse, 3×3 dilated closest-depth lookup, Karis '14 variance-based neighborhood clamping in Reinhard-tonemapped space, velocity-adaptive blend (5–12%).
  • tsaa.tech — Fullscreen technique definition (no depth, no cull).

Pipeline integration (DefaultForwardPipeline)

  • Generates Halton(2,3) sub-pixel jitter (16-sample cycle), applies to projection matrix via new SceneView::SetJitter(), and writes jitter UV to ShaderPassInfo.
  • Inserts TSAAPass between forward and post-processing. PostProcessingPass now reads TSAAColor instead of ForwardColor.

Core changes

  • SceneViewSetJitter(float, float) offsets projects[i] columns 2,0/2,1 before computing viewProject. Jitter bakes into both current and lastViewProject, so motion vectors are correct without explicit unjitter.
  • ShaderPassInfo — Appended Vector4 jitter (trailing field, no ABI break for existing shaders that only read up to Viewport).
  • PostProcessingPass — Constructor now takes optional std::string_view inputColorName defaulting to FWD_CL for backward compatibility.
  • DefaultPassConstants — Added TSAA_CL, TSAA_HIST.

Shader algorithm sketch

// 1. Dilated depth → closest 3×3 neighbor for edge-stable motion vectors
// 2. inv(ViewProj) * clipPos → worldPos → LastViewProj → prevUV
// 3. Variance clip: μ ± 1.25σ clamped to min/max AABB in tonemapped space
// 4. blend = lerp(0.05, 0.12, saturate(|velocity| * 20))
// 5. Reject history if reprojected UV is offscreen
result = lerp(clampedHistory, currentColor, blend);

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits March 7, 2026 15:36
Add TSAAPass with ping-pong history buffers, Halton-based sub-pixel
jitter, motion vector reprojection via inverse ViewProj, and
variance-based neighborhood clamping (Karis 2014).

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
… remove accidental log file

Co-authored-by: bluesky013 <35895395+bluesky013@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement TSAA solution Implement TSAA (Temporal Specular Anti-Aliasing) pipeline Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants