feat(render): opt-in --supersample (SSAA) for crisp moving text#94
Merged
Conversation
Render N× via Chromium deviceScaleFactor and Lanczos-downscale to the scene size at encode — the standard cure for anti-alias shimmer on moving text (the 2.5D affine perspective re-skews glyph edges every frame). On render/frame and the composition path; alias --ss, clamped 1-4, default 1 = off → byte-identical to today (determinism goldens unchanged). frameLoop threads deviceScaleFactor through withPage + adds downscalePng; encode.ts gains a downscale -vf scale. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-in
--supersample N(alias--ss) torender/frame: render at N× and Lanczos-downscale to the scene size, the standard fix for anti-alias shimmer on moving text. reframe's 2.5D perspective is an affine approximation that re-skews glyph edges every frame, so text under a card flip/tilt flickers subtly at 1×; supersampling gives the AA headroom to smooth it.How
frameLoop.ts—withPagetakes adeviceScaleFactor(default 1); threaded intocaptureIr/renderFrameAt/captureHtml. At N× the captured PNG is N×-sized. NewdownscalePng(buf,w,h)(ffmpeg Lanczos) for the single-frame path.encode.ts—encodeMp4gains adownscale?: {width,height}→ inserts-vf scale=W:H:flags=lanczos. Frames render N×, mp4 comes out at scene size.cli.ts/frame.ts/composition.ts— parse--supersample/--ss(clamp 1–4), thread through the IR/HTML/composition render paths + the single-frame downscale.Golden-safe / determinism
Default (no flag) =
deviceScaleFactor:1, no scale filter → byte-identical to today.determinism.test.tsunchanged and green. No IR/DisplayList change. N× is itself deterministic (fixed chromium flags + Lanczos + fixed encode).Verification
pnpm test— 446 pass incl. byte-identical determinism;pnpm typecheck+pnpm lintclean.reframe frame scene.ts --t 5.5 --ss 1vs--ss 2→ both output 1920×1080 (downscaled from 2×); the--ss 2frame has smoother text edges (and compresses smaller — less AA noise).Out of scope
batch --supersample(batch has its own render loop; a follow).player(live browser, N/A).🤖 Generated with Claude Code