summaryrefslogtreecommitdiffstats
path: root/math.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-04-08 17:52:52 -0700
committeryum <yum.food.vr@gmail.com>2025-04-08 17:52:52 -0700
commit40c33d438afa036acfcbc58ca4078f25db1624f2 (patch)
tree045d3d3b44e785ad7d8fbaaa2ec874585a5d9773 /math.cginc
parent2dfd6322587eb095a5a4f7b22d70e1abcc14d5e3 (diff)
Add static flag to limit fallback cubemap to metallic
Diffstat (limited to 'math.cginc')
-rw-r--r--math.cginc6
1 files changed, 3 insertions, 3 deletions
diff --git a/math.cginc b/math.cginc
index bccb206..6c48a2c 100644
--- a/math.cginc
+++ b/math.cginc
@@ -16,10 +16,10 @@ float pow5(float x)
}
float wrapNoL(float NoL, float k) {
-#if 0
+#if 1
// https://www.iro.umontreal.ca/~derek/files/jgt_wrap_final.pdf
return pow(max(1E-4, (NoL + k) / (1 + k)), 1 + k);
-#else
+#else
float k_sq = k * k;
float b = max(0, lerp(NoL, 1.0, k));
float p = -6.0 * k_sq + 5.0 * k + 1.0;
@@ -27,7 +27,7 @@ float wrapNoL(float NoL, float k) {
float F = pow(b, p);
// Approximate integral of NoL with respect to theta
- float I = 0.7856 * k_sq - 0.2148 * k + 1.0;
+ float I = (0.7856 * k_sq - 0.2148 * k) + 1.0;
float G = F / max(I, 1E-6);