sixthsurge / photon

A gameplay-focused shader pack for Minecraft
MIT License
1.08k stars 204 forks source link

Don't square roughness for specular sampling #205

Closed jbritain closed 3 months ago

jbritain commented 3 months ago

For the GGX distribution used for specular sampling, resources generally state that you should square the roughness to get the correct alpha value. This, however, assumes (to my knowledge) that the roughness value is perceptual (i.e non-linear). Since the LabPBR standard stores perceptual smoothness, and the conversion to roughness already converts it to linear sqr(1.0 - specular_map.r), it is incorrect to then square it again.