Fix anisotropic ibl bend factor#24515
Open
issam3105 wants to merge 1 commit into
Open
Conversation
olukowski
approved these changes
Jun 2, 2026
Contributor
There was a problem hiding this comment.
Seems the original code assumed pow(a, b) computes b^a, which isn't the case. I was briefly thinking about whether something like:
let bendFactor = 1.0 - anisotropy * (1.0 - roughness);
bent_normal = normalize(mix(bent_normal, N, pow(bendFactor, 4.0)));would make more sense, but then I realized plain multiplication is probably faster.
So looks good!
IceSentry
approved these changes
Jun 2, 2026
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.
Objective
Fix incorrect anisotropic IBL normal bending for
KHR_materials_anisotropy.The previous formula computed
2^(2^x)instead of thex^4bend factor described by the glTF anisotropy reference implementation. This caused anisotropy to affect areas where the anisotropy texture strength should be zero, visibly producing square texture bounds in assets such as KhronosAnisotropyDiscTest.Solution
Replace the incorrect nested
powexpression with the explicit fourth-power bend factor used by the Khronos glTF Sample ViewerTesting
Reviewers can visually test this with the Khronos
AnisotropyDiscTestandCompareAnisotropy.Showcase
Before this PR
After
Ref Khronos
Before
After
Ref Khronos
(In this asset, KHR_texture_transform is applied to the normal map, so the normal detail may not line up exactly with the Khronos viewer even after the anisotropy bend factor is fixed)