summaryrefslogtreecommitdiffstats
path: root/poi.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-10-07 14:41:33 -0700
committeryum <yum.food.vr@gmail.com>2024-10-07 14:41:33 -0700
commite51760ab5e6d698b26b60e1811e7afce62be55d0 (patch)
treeb7bb304f703f47958ce59ebf906f6f5ad6ca4480 /poi.cginc
parent144d7bc5cc999b9c5f84a9a7fc2a86dafe276df1 (diff)
Fix center eye toggle in rim lighting
Also add bayer dithering logic (not used yet).
Diffstat (limited to 'poi.cginc')
-rw-r--r--poi.cginc23
1 files changed, 23 insertions, 0 deletions
diff --git a/poi.cginc b/poi.cginc
index f5019d7..6a0d5f3 100644
--- a/poi.cginc
+++ b/poi.cginc
@@ -123,4 +123,27 @@ float3 getPoiLightingIndirect() {
return BetterSH9(float4(0, 0, 0, 1));
}
+inline half Dither8x8Bayer(int x, int y)
+{
+ // Premultiplied by 1/64
+ const half dither[ 64 ] = {
+ 0.015625, 0.765625, 0.203125, 0.953125, 0.06250, 0.81250, 0.25000, 1.00000,
+ 0.515625, 0.265625, 0.703125, 0.453125, 0.56250, 0.31250, 0.75000, 0.50000,
+ 0.140625, 0.890625, 0.078125, 0.828125, 0.18750, 0.93750, 0.12500, 0.87500,
+ 0.640625, 0.390625, 0.578125, 0.328125, 0.68750, 0.43750, 0.62500, 0.37500,
+ 0.046875, 0.796875, 0.234375, 0.984375, 0.03125, 0.78125, 0.21875, 0.96875,
+ 0.546875, 0.296875, 0.734375, 0.484375, 0.53125, 0.28125, 0.71875, 0.46875,
+ 0.171875, 0.921875, 0.109375, 0.859375, 0.15625, 0.90625, 0.09375, 0.84375,
+ 0.671875, 0.421875, 0.609375, 0.359375, 0.65625, 0.40625, 0.59375, 0.34375
+ };
+ int r = y * 8 + x;
+ return dither[r];
+}
+
+half calcDither(half2 grabPos)
+{
+ return Dither8x8Bayer(glsl_mod(grabPos.x, 8), glsl_mod(grabPos.y, 8));
+}
+
+
#endif // __POI_INC