KhronosGroup / glTF-Sample-Viewer

Physically-Based Rendering in glTF 2.0 using WebGL
Apache License 2.0
1.21k stars 229 forks source link

Albedo Sheen Scaling is likely handled incorrectly #519

Closed TheMostDiligent closed 3 weeks ago

TheMostDiligent commented 5 months ago

The albedoSheenScaling constant is computed inside the light processing loop, so each next light overwrites the previous value and only the value from the last light is used. This means that depending on the order in which the lights are defined, the result will be different.

Furthermore, the resulting constant is then used to scale the emissive, diffuse and specular components. This means that direction of the last light will affect IBL and emissive components, which does not make a lot of sense.

I think the logic should be that albedoSheenScaling is only applied to the punctual lighting of the base layer of the same light. I don't know how IBL and Emissive should be handled. Probably the scaling should only depend on (n, v)