Skip to content

feat(layers): add PointCloudLayer analytic antialiasing - #10560

Merged
chrisgervang merged 9 commits into
chrisgervang/arc-layer-antialiasingfrom
chrisgervang/point-cloud-layer-antialiasing
Aug 21, 2026
Merged

chrisgervang merged 9 commits into
chrisgervang/arc-layer-antialiasingfrom
chrisgervang/point-cloud-layer-antialiasing

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Goal

Add opt-in analytic antialiasing to PointCloudLayer's circular point silhouette.

Change List

  • Add PointCloudLayer.antialiasing, defaulting to false.
  • Replace the hard circular boundary with a derivative-scaled coverage ramp when enabled.
  • Preserve the existing hard-discard behavior when disabled.
  • Include PointCloudLayer API documentation, uniform coverage, isolated no-MSAA WebGL coverage, and WebGPU premultiplication coverage.

Validation

  • Focused PointCloudLayer headless test
  • Focused WebGL and WebGPU render tests
  • Included in stack-wide yarn lint and yarn build

Performance benchmark

Extends yarn bench-antialiasing with 100K sparse 2px PointCloudLayer points. On an Apple M1 Max running macOS 26.3 in headless Chrome 151.0.7922.138, the median of 100 alternating GPU timestamp samples was 2.688→2.865 ms (+7%) on WebGL2 and 1.518→1.565 ms (+3%) on WebGPU.

Visual comparison

The render-test device has framebuffer MSAA disabled. Left: antialiasing: false. Right: antialiasing: true.

PointCloudLayer analytic antialiasing comparison


Note

Medium Risk
Touches PointCloudLayer vertex/fragment shaders on WebGL and WebGPU, which can change edge coverage and overlap blending. Default remains off, so existing renders are unaffected unless the prop is enabled.

Overview
Adds opt-in antialiasing on PointCloudLayer (default false) so circular point silhouettes can be feathered in the shader instead of relying on framebuffer MSAA.

When enabled, GLSL and WGSL expand the enclosing triangle by a device-pixel envelope and replace the hard distToCenter > 1 discard with a derivative-scaled smoothedge alpha ramp. The default path is unchanged. Toggling the prop recreates the model via an ANTIALIASING define.

Docs, shader-variant unit tests, no-MSAA WebGL coverage checks, a WebGPU premultiplication check, a golden image, and a 100K-point bench workload cover the new path.

Reviewed by Cursor Bugbot for commit 813a1ad. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7935652. Configure here.

@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 7935652 to ac6af67 Compare August 14, 2026 00:52
@coveralls

coveralls commented Aug 14, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 82.218% — chrisgervang/point-cloud-layer-antialiasing into chrisgervang/arc-layer-antialiasing. No base build found for chrisgervang/arc-layer-antialiasing.

@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from ac6af67 to 3210fb9 Compare August 14, 2026 17:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 3210fb9 to 5614c83 Compare August 14, 2026 18:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 5614c83 to 7e97c8f Compare August 14, 2026 19:44

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the lightest default-off regression in the stack because distToCenter already existed, but the disabled shader still gains a runtime uniform branch, an initialized edgePixels, a more complex discard predicate, and the enabled derivative path remains in the compiled pipeline. That falls short of a zero-cost opt-out even though pixels remain unchanged.

For consistency with the other primitive layers, could antialiasing select an AA-on/off shader variant on the CPU instead of being a fragment uniform? The default variant can retain the original hard-discard shader exactly, while changing the prop pays the one-time model/pipeline recreation cost.

@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 7e97c8f to 2dd49a8 Compare August 15, 2026 00:43
@chrisgervang

chrisgervang commented Aug 15, 2026 •

Copy link
Copy Markdown
Collaborator Author

Addressed in 2dd49a8. PointCloudLayer now selects compile-time GLSL/WGSL variants and recreates its model on an antialiasing transition. The default variant retains the original hard-discard shader with no AA uniform, derivative, coverage envelope, or extra discard branch. Focused source and lifecycle tests cover both variants.

@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch 2 times, most recently from 4d75e0f to 74d9544 Compare August 15, 2026 23:39
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch 2 times, most recently from 5b81a04 to 77e6a45 Compare August 17, 2026 21:45
@greptile-apps

greptile-apps Bot commented Aug 17, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR adds opt-in analytic antialiasing for PointCloudLayer while retaining the existing hard-edge shader path by default.

  • Adds GLSL and WGSL coverage-ramp shader variants.
  • Recreates the layer model when the shader variant changes.
  • Documents the new property and adds shader, render, WebGPU premultiplication, and benchmark coverage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
modules/layers/src/point-cloud-layer/point-cloud-layer.ts Adds the antialiasing property, selects the shader define, and follows the established model-recreation lifecycle when toggled.
modules/layers/src/point-cloud-layer/point-cloud-layer-vertex.glsl.ts Expands enabled point geometry by a device-pixel coverage envelope while preserving the default shader path.
modules/layers/src/point-cloud-layer/point-cloud-layer-fragment.glsl.ts Adds derivative-scaled alpha coverage when enabled and retains hard discard when disabled.
modules/layers/src/point-cloud-layer/point-cloud-layer.wgsl.ts Implements the corresponding WebGPU geometry expansion and coverage behavior with premultiplication applied afterward.
test/render/test-cases/point-cloud-layer.spec.ts Adds isolated no-MSAA WebGL coverage, cross-backend golden rendering, and WebGPU premultiplication validation.
test/modules/layers/point-cloud-layer.spec.ts Verifies shader specialization, default fast-path preservation, and model recreation when antialiasing is enabled.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[PointCloudLayer antialiasing prop] --> B{Enabled?}
  B -- No --> C[Compile default shader variant]
  C --> D[Discard fragments outside circle]
  B -- Yes --> E[Compile analytic AA variant]
  E --> F[Expand enclosing triangle]
  F --> G[Compute derivative-scaled edge coverage]
  G --> H[Apply coverage to alpha]
Loading

Reviews (18): Last reviewed commit: "refactor(point-cloud-layer): use named W..." | Re-trigger Greptile

@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 77e6a45 to 3761fca Compare August 18, 2026 18:09
@chrisgervang chrisgervang added this to the v9.4 milestone Aug 19, 2026
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 3761fca to 8d00a55 Compare August 19, 2026 00:15
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 9388d19 to 9e59512 Compare August 20, 2026 03:38
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 9e59512 to a982aaa Compare August 20, 2026 05:36
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from a982aaa to 16388e1 Compare August 20, 2026 05:47
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 16388e1 to 11e8cce Compare August 20, 2026 17:44
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch 2 times, most recently from 15667d7 to b4a59d7 Compare August 20, 2026 18:45
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch 2 times, most recently from e24a0fc to 455ff42 Compare August 20, 2026 23:25
@chrisgervang
chrisgervang force-pushed the chrisgervang/point-cloud-layer-antialiasing branch from 455ff42 to 813a1ad Compare August 20, 2026 23:33
@chrisgervang
chrisgervang merged commit 5e0084c into master Aug 21, 2026
12 checks passed
@chrisgervang
chrisgervang deleted the chrisgervang/point-cloud-layer-antialiasing branch August 21, 2026 02:46
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.

4 participants