Skip to content

feat: add geometricPrecision edge coverage - #7

Merged
LukyVj merged 1 commit into
LukyVj:release/0.0.6from
michaelsilva:feat/shape-rendering-geometric-precision
Oct 8, 2026
Merged

LukyVj merged 1 commit into
LukyVj:release/0.0.6from
michaelsilva:feat/shape-rendering-geometric-precision

Conversation

@michaelsilva

@michaelsilva michaelsilva commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Implements the antialiasing direction agreed in #2 without supersampling, extra camera rays, an extra pass, or a larger backing store.

What changes

  • scene { shape-rendering: geometricPrecision; }; auto remains the default and emits the previous shader unchanged
  • the primary ray remembers its previous distance sample, but promotes it only after the next step proves the ray passed that local minimum without hitting it, or another surface became nearest
  • only a passed sample within t * pixelSize becomes silhouette coverage; a ray still converging on an exact hit never becomes an edge candidate
  • floor id 0 is never promoted as a shape silhouette
  • a passed foreground silhouette can still blend over a farther exact hit
  • the grazing object's id is retained, so the saved point is shaded with the correct material
  • the whole-scene sphere fast path is widened by one pixel only for geometric precision, so it cannot discard a valid grazing silhouette
  • GLSL and WGSL share the generated path
  • registry, docs navigation, roadmap and changelog are updated

Decision sequencing

PR #6 is the older contribution and owns decision 139. This draft therefore intentionally does not add a decision entry yet rather than introducing an out-of-order 140 on a branch where 139 is absent.

After #6 lands, this PR should take decision 140, update its roadmap reference, and advance the repository's next-decision pointer in the same change.

Tests in the PR

  • compiler contract: default/explicit auto shader identity, syntax validation, @media, passed-near-miss codegen and WGSL lowering
  • real-render WebGL2 + WebGPU test with non-flat lighting: every exact sphere hit must remain unchanged while missed silhouette rays gain partial coverage
  • real-render WebGL2 + WebGPU test with a red foreground sphere over a larger blue sphere: the passed foreground silhouette must blend over the farther blue hit
  • the registry example remains covered by the existing documented-example GPU suites

The precision helper also passes standalone TypeScript syntax checking. An analytic 96x72 sphere trace of the same camera geometry produces silhouette candidates on missed grazing rays and zero candidates on exact-hit rays.

Performance proof before review

Keeping this PR in draft until the requested real-GPU comparison is recorded. The repository benchmark requires visible Chromium on a real GPU.

To isolate the feature cost, compare the committed branch (auto) with the same branch plus a temporary working-tree opt-in on the heavy orrery scene:

node -e 'const fs=require("fs"),p="src/scenes/orrery.gss";let s=fs.readFileSync(p,"utf8");s=s.replace("\nscene {","\nscene {\n  shape-rendering: geometricPrecision;");fs.writeFileSync(p,s)'
npm run bench:compare -- HEAD --scenes orrery --dpr 2
git restore src/scenes/orrery.gss

This measures auto versus geometricPrecision on otherwise identical source. The visual diff is expected; the requested evidence is the before/after frame/GPU timing in bench-results/compare.md.

Vercel currently reports the external-fork authorization gate, not a build result.

Fixes #2

@vercel

vercel Bot commented Oct 6, 2026

Copy link
Copy Markdown

@michaelsilva is attempting to deploy a commit to the Lucasbonomi Team on Vercel.

A member of the Team first needs to authorize it.

@michaelsilva
michaelsilva force-pushed the feat/shape-rendering-geometric-precision branch 4 times, most recently from 75c51f0 to 66e52fb Compare October 6, 2026 17:00
Promote a subpixel silhouette only after the existing primary ray passes
its local distance minimum without hitting it, so exact-hit pixels shade
once. Preserve the auto shader, foreground-over-background coverage, the
scene-bound fast path, GLSL/WGSL parity, and repo-native tests/docs.

Decision number is intentionally deferred behind PR #6.
Refs LukyVj#2
@michaelsilva
michaelsilva force-pushed the feat/shape-rendering-geometric-precision branch from 3c04386 to 3931586 Compare October 6, 2026 17:02
@LukyVj
LukyVj changed the base branch from main to release/0.0.6 October 7, 2026 13:14
LukyVj added a commit that referenced this pull request Oct 8, 2026
…c-precision

feat: add geometricPrecision edge coverage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LukyVj
LukyVj merged commit eed6324 into LukyVj:release/0.0.6 Oct 8, 2026
1 check failed
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.

Antialiasing

2 participants