Repository navigation
Conversation
calcLightSpecular in the anisotropic GGX chunk took roughness as (1 - gloss)^2 and then squared it again for alphaRoughness, so at and ab were built from perceptual roughness to the fourth power. The Khronos KHR_materials_anisotropy reference derives them from alphaRoughness = perceptualRoughness^2, so anisotropic highlights came out too narrow. Compute alphaRoughness directly in both the GLSL and WGSL chunks. Fixed playcanvas#9511
getReflDir in reflDirAniso computed the bend roughness as sqrt(1 - gloss), i.e. sqrt(perceptualRoughness). The glTF Sample Renderer's getIBLRadianceAnisotropy is called with perceptualRoughness itself, so glossy anisotropic materials were bent less than they should be. Use 1 - gloss in both the GLSL and WGSL chunks, and cover it in the anisotropy chunk test alongside the alphaRoughness check. Fixes playcanvas#9511
This branch has not been deployed
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.
Description
This covers both parts of the issue, in the GLSL and WGSL chunks.
The anisotropic GGX chunk squared
(1 - gloss)^2again, soatandabcame from perceptualRoughness^4. It now usesalphaRoughness = (1 - gloss)^2directly.reflDirAnisobent the reflection normal withsqrt(1 - gloss); it now uses1 - gloss, matching the referencegetIBLRadianceAnisotropy.It is a visible change: anisotropic highlights get noticeably wider and less intense, and glossy anisotropic reflections bend more. A new unit test evaluates the roughness lines of all four chunks; it fails on main and passes here.
npm testandnpm run lintare clean.#9513 covers the separate isotropic bug (#9510).
Fixes #9511
Checklist