summaryrefslogtreecommitdiffstats
path: root/pbr_utils.cginc
blob: c8c10cca77942c961619216f7b29e92c2b00a030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef __PBR_UTILS_INC
#define __PBR_UTILS_INC

float perceptualRoughnessToRoughness(float perceptualRoughness) {
    return perceptualRoughness * perceptualRoughness;
}

float roughnessToPerceptualRoughness(float roughness) {
    return sqrt(roughness);
}

float smoothnessToPerceptualRoughness(float smoothness) {
  return 1.0f - smoothness;
}

float smoothnessToRoughness(float smoothness) {
  return perceptualRoughnessToRoughness(smoothnessToPerceptualRoughness(smoothness));
}

#endif  // __PBR_UTILS_INC