fuckingtech/public/assets/glsl/lygia/lighting/common/perceptual2linearRoughness.hlsl
Elias Rhouzlane bf76c6b086 fix: code
2025-04-06 17:23:52 +02:00

20 lines
No EOL
763 B
HLSL

/*
contributors: Shadi El Hajj
description: Classic Disney reparametrisation of roughness from Burley's paper "Physically Based Shading At Disney". Sébastien Lagarde's recommends clamping perceptual roughness to 0.045 in his paper "Moving Frostbite to PBR".
use: <float> perceptual2linearRoughness(<float> perceptualRoughness)
license: MIT License (MIT) Copyright (c) 2024 Shadi EL Hajj
*/
#ifndef MIN_PERCEPTUAL_ROUGHNESS
#define MIN_PERCEPTUAL_ROUGHNESS 0.045
#endif
#ifndef FNC_PERCEPTUAL_LINEAR_ROUGHNESS
#define FNC_PERCEPTUAL_LINEAR_ROUGHNESS
float perceptual2linearRoughness(float perceptualRoughness) {
perceptualRoughness = clamp(perceptualRoughness, MIN_PERCEPTUAL_ROUGHNESS, 1.0);
return perceptualRoughness * perceptualRoughness;
}
#endif