From 4bd9c2ba494013f292ddc14d793bc2b362aff365 Mon Sep 17 00:00:00 2001 From: yum Date: Fri, 31 Jan 2025 21:11:00 -0800 Subject: Add bayer matrices & grabpass-based lens shader --- math.cginc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'math.cginc') diff --git a/math.cginc b/math.cginc index 80fa9ab..bb422a4 100644 --- a/math.cginc +++ b/math.cginc @@ -7,6 +7,25 @@ #define TAU PI * 2.0 #define PHI 1.618033989 +static const float BayerM4x4[16] = { + 0.0/15.0, 8.0/15.0, 2.0/15.0, 10.0/15.0, + 12.0/15.0, 4.0/15.0, 14.0/15.0, 6.0/15.0, + 3.0/15.0, 11.0/15.0, 1.0/15.0, 9.0/15.0, + 15.0/15.0, 7.0/15.0, 13.0/15.0, 5.0/15.0 +}; + +// xdd +static const float BayerM8x8[64] = { + 0.0/63.0, 32.0/63.0, 8.0/63.0, 40.0/63.0, 2.0/63.0, 34.0/63.0, 10.0/63.0, 42.0/63.0, + 48.0/63.0, 16.0/63.0, 56.0/63.0, 24.0/63.0, 50.0/63.0, 18.0/63.0, 58.0/63.0, 26.0/63.0, + 12.0/63.0, 44.0/63.0, 4.0/63.0, 36.0/63.0, 14.0/63.0, 46.0/63.0, 6.0/63.0, 38.0/63.0, + 60.0/63.0, 28.0/63.0, 52.0/63.0, 20.0/63.0, 62.0/63.0, 30.0/63.0, 54.0/63.0, 22.0/63.0, + 3.0/63.0, 35.0/63.0, 11.0/63.0, 43.0/63.0, 1.0/63.0, 33.0/63.0, 9.0/63.0, 41.0/63.0, + 51.0/63.0, 19.0/63.0, 59.0/63.0, 27.0/63.0, 49.0/63.0, 17.0/63.0, 57.0/63.0, 25.0/63.0, + 15.0/63.0, 47.0/63.0, 7.0/63.0, 39.0/63.0, 13.0/63.0, 45.0/63.0, 5.0/63.0, 37.0/63.0, + 63.0/63.0, 31.0/63.0, 55.0/63.0, 23.0/63.0, 61.0/63.0, 29.0/63.0, 53.0/63.0, 21.0/63.0 +}; + // Hacky parameterizable whiteout blending. Probably some big mistakes but it // passes the eyeball test. // At w=0.5, this looks kinda like whiteout blending. -- cgit v1.2.3