From 65ed0c23335b10a266d76257eeb3e7ecfd23cfb5 Mon Sep 17 00:00:00 2001 From: yum Date: Thu, 20 Feb 2025 00:07:46 -0800 Subject: Add directionality and quantization to rim lighting --- math.cginc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'math.cginc') diff --git a/math.cginc b/math.cginc index 414f618..8edbc88 100644 --- a/math.cginc +++ b/math.cginc @@ -17,6 +17,12 @@ float wrapNoL(float NoL, float factor) { return pow(max(1E-4, (NoL + factor) / (1 + factor)), 1 + factor); } +float halfLambertianNoL(float NoL) { + // https://www.iro.umontreal.ca/~derek/files/jgt_wrap_final.pdf + float tmp = (NoL + 1) * 0.5; + return tmp * tmp; +} + float rand1(float p) { return frac(sin(p) * 43758.5453123); -- cgit v1.2.3