Specular aa#24427
Conversation
|
Welcome, new contributor! Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨ |
|
I think it might be nice to have an example for this, if you're willing to port your playground over, either as part of this PR or a follow-up |
hmm I think I --probably-- could reproduce this with a procedual ways via voronoi normal on the cpu... |
|
The generated |
|
It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note. Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes. |
|
Yeah, we need an example of some sort here so we can demonstrate and test this :) |
here it is 🙂 |
Objective
try to fix: #24288
Solution
Adds geometric specular anti aliasing as an opt-in toggle on StandardMaterial. When enabled, the PBR fragment shader widens the squared GGX alpha based on dpdx/dpdy of the shading normal:
from Tokuyoshi and Kaplanyan, "Improved Geometric Specular Antialiasing" (I3D 2019)
3 new fields on StandardMaterial:
note that deafults are from paper.
The clearcoat normal is filtered separately when the clearcoat layer is active. The block is skipped in the meshlet pass since its software rasterizer doesn't provide pixel-quad derivatives...
note that On extremely high freq normal maps without mip chains, the kernel can over widen at sharp texture features. A natural follow up/todo is normal map mipmap gen paired with a Toksvig/LEAN factor folded into the same kernel addition, but that touches asset loading and is meaningfully bigger than this shader change, so I left it as future work...
Testing
Tested on macOS / Apple M3 (Metal) 16gb.
I built an interactive playground locally (kept out of this PR to keep the diff focused) where I could toggle the flag and live tweak σ/κ (variance and threshold values) while a normal mapped object spun under an orbiting light. The visible signature in motion is what you'd expect: with AA off the highlight shimmers as the light sweeps across the normal map detail, with AA on it stays stable. the visible benefit is mostly temporal stability, which is hard to capture in a still I tried to record a video below :/
Showcase
diff between on and off:
Screen.Recording.2026-05-25.at.00_compressed.32.27.mov
More context: In my game, I was seeing "glitters/luminescences" in exactly this texture (btw texture from: https://freestylized.com/material/ground_stones_01/ ), which I didn't want. Applying this made the "glitter" disappear without using TAA :-) .