diff options
| author | yum <yum.food.vr@gmail.com> | 2025-08-06 16:42:42 -0700 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-08-06 16:42:42 -0700 |
| commit | 99d161288bfe2d10c331c97e6b7571f9c884e912 (patch) | |
| tree | 6ef130c4801de52f697c8d6996d9c4b0fb5f3964 /pbr_utils.cginc | |
initial commit
Diffstat (limited to 'pbr_utils.cginc')
| -rw-r--r-- | pbr_utils.cginc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pbr_utils.cginc b/pbr_utils.cginc new file mode 100644 index 0000000..c8c10cc --- /dev/null +++ b/pbr_utils.cginc @@ -0,0 +1,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 |
