Skip to content

fix(shader): reduce specular aliasing on envAtlas reflections#8955

Open
willeastcott wants to merge 2 commits into
mainfrom
fix/specular-aliasing-envatlas
Open

fix(shader): reduce specular aliasing on envAtlas reflections#8955
willeastcott wants to merge 2 commits into
mainfrom
fix/specular-aliasing-envatlas

Conversation

@willeastcott

@willeastcott willeastcott commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

The envAtlas reflection chunk only applied screen-space derivative antialiasing (shinyMipLevel) for near-mirror surfaces (ilevel == 0). All rougher materials selected the reflection mip from material gloss alone, ignoring screen-space minification, so curved/minified glossy surfaces aliased badly — a regression from the pre-v1.51 prefiltered-cubemap pipeline.

This folds the screen-space minification level into the roughness level via level = max(level, shinyMipLevel(...)) before flooring, so reflections blur to track minification at all gloss levels. The change is monotonic (blur never decreases), so it cannot introduce new aliasing. Applied to both the GLSL and WGSL chunks for backend parity.

Tradeoff: distant near-mirror surfaces are very slightly softer under minification (the "shiny" atlas mip pyramid is bypassed), which matches the smoother pre-v1.51 look.

Fixes #8431

Before / after

Reporter's project rendered against this branch (engine source, identical camera). Note the embossed sheet-metal panel and the drum rim — the broken/sparkly specular highlights become smooth and continuous:

Before (main) After (this PR)
before after

Checklist

  • I have read the contributing guidelines
  • My code follows the project's coding standards
  • This PR focuses on a single change

The envAtlas reflection chunk only applied screen-space derivative
antialiasing (shinyMipLevel) for near-mirror surfaces (ilevel == 0).
All rougher materials selected the reflection mip from material gloss
alone, ignoring screen-space minification, so curved/minified glossy
surfaces aliased badly.

Fold the screen-space minification level into the roughness level via
max(level, shinyMipLevel(...)) before flooring, so reflections blur to
track minification at all gloss levels. Applied to both the GLSL and
WGSL chunks for backend parity.

Fixes #8431

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Build size report

This PR changes the size of the minified bundles.

Bundle Minified Gzip Brotli
playcanvas.min.js 2260.7 KB (−0.4 KB, −0.02%) 581.7 KB (−0.0 KB, −0.01%) 452.0 KB (+0.0 KB, +0.01%)
playcanvas.min.mjs 2258.1 KB (−0.4 KB, −0.02%) 580.8 KB (−0.1 KB, −0.01%) 451.8 KB (+0.1 KB, +0.02%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Specular aliasing after using envAtlas

1 participant