137 lines
123 KiB
Plaintext
137 lines
123 KiB
Plaintext
|
//
|
||
|
// This program is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU Lesser General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU Lesser General Public License
|
||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
|
|
||
|
//!DESC RAVU-Lite (step1, r3)
|
||
|
//!HOOK LUMA
|
||
|
//!BIND HOOKED
|
||
|
//!BIND ravu_lite_lut3
|
||
|
//!SAVE ravu_lite_int
|
||
|
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
|
||
|
//!COMPONENTS 4
|
||
|
vec4 hook() {
|
||
|
float luma0 = HOOKED_texOff(vec2(-2.0, -2.0)).x;
|
||
|
float luma1 = HOOKED_texOff(vec2(-2.0, -1.0)).x;
|
||
|
float luma2 = HOOKED_texOff(vec2(-2.0, 0.0)).x;
|
||
|
float luma3 = HOOKED_texOff(vec2(-2.0, 1.0)).x;
|
||
|
float luma4 = HOOKED_texOff(vec2(-2.0, 2.0)).x;
|
||
|
float luma5 = HOOKED_texOff(vec2(-1.0, -2.0)).x;
|
||
|
float luma6 = HOOKED_texOff(vec2(-1.0, -1.0)).x;
|
||
|
float luma7 = HOOKED_texOff(vec2(-1.0, 0.0)).x;
|
||
|
float luma8 = HOOKED_texOff(vec2(-1.0, 1.0)).x;
|
||
|
float luma9 = HOOKED_texOff(vec2(-1.0, 2.0)).x;
|
||
|
float luma10 = HOOKED_texOff(vec2(0.0, -2.0)).x;
|
||
|
float luma11 = HOOKED_texOff(vec2(0.0, -1.0)).x;
|
||
|
float luma12 = HOOKED_texOff(vec2(0.0, 0.0)).x;
|
||
|
float luma13 = HOOKED_texOff(vec2(0.0, 1.0)).x;
|
||
|
float luma14 = HOOKED_texOff(vec2(0.0, 2.0)).x;
|
||
|
float luma15 = HOOKED_texOff(vec2(1.0, -2.0)).x;
|
||
|
float luma16 = HOOKED_texOff(vec2(1.0, -1.0)).x;
|
||
|
float luma17 = HOOKED_texOff(vec2(1.0, 0.0)).x;
|
||
|
float luma18 = HOOKED_texOff(vec2(1.0, 1.0)).x;
|
||
|
float luma19 = HOOKED_texOff(vec2(1.0, 2.0)).x;
|
||
|
float luma20 = HOOKED_texOff(vec2(2.0, -2.0)).x;
|
||
|
float luma21 = HOOKED_texOff(vec2(2.0, -1.0)).x;
|
||
|
float luma22 = HOOKED_texOff(vec2(2.0, 0.0)).x;
|
||
|
float luma23 = HOOKED_texOff(vec2(2.0, 1.0)).x;
|
||
|
float luma24 = HOOKED_texOff(vec2(2.0, 2.0)).x;
|
||
|
vec3 abd = vec3(0.0);
|
||
|
float gx, gy;
|
||
|
gx = (luma11-luma1)/2.0;
|
||
|
gy = (luma7-luma5)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163;
|
||
|
gx = (luma12-luma2)/2.0;
|
||
|
gy = (luma8-luma6)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666;
|
||
|
gx = (luma13-luma3)/2.0;
|
||
|
gy = (luma9-luma7)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163;
|
||
|
gx = (luma16-luma6)/2.0;
|
||
|
gy = (luma12-luma10)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666;
|
||
|
gx = (luma17-luma7)/2.0;
|
||
|
gy = (luma13-luma11)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.13080118386382833;
|
||
|
gx = (luma18-luma8)/2.0;
|
||
|
gy = (luma14-luma12)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666;
|
||
|
gx = (luma21-luma11)/2.0;
|
||
|
gy = (luma17-luma15)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163;
|
||
|
gx = (luma22-luma12)/2.0;
|
||
|
gy = (luma18-luma16)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.11543163961422666;
|
||
|
gx = (luma23-luma13)/2.0;
|
||
|
gy = (luma19-luma17)/2.0;
|
||
|
abd += vec3(gx * gx, gx * gy, gy * gy) * 0.1018680644198163;
|
||
|
float a = abd.x, b = abd.y, d = abd.z;
|
||
|
float T = a + d, D = a * d - b * b;
|
||
|
float delta = sqrt(max(T * T / 4.0 - D, 0.0));
|
||
|
float L1 = T / 2.0 + delta, L2 = T / 2.0 - delta;
|
||
|
float sqrtL1 = sqrt(L1), sqrtL2 = sqrt(L2);
|
||
|
float theta = mix(mod(atan(L1 - a, b) + 3.141592653589793, 3.141592653589793), 0.0, abs(b) < 1.192092896e-7);
|
||
|
float lambda = sqrtL1;
|
||
|
float mu = mix((sqrtL1 - sqrtL2) / (sqrtL1 + sqrtL2), 0.0, sqrtL1 + sqrtL2 < 1.192092896e-7);
|
||
|
float angle = floor(theta * 24.0 / 3.141592653589793);
|
||
|
float strength = mix(mix(0.0, 1.0, lambda >= 0.004), mix(2.0, 3.0, lambda >= 0.05), lambda >= 0.016);
|
||
|
float coherence = mix(mix(0.0, 1.0, mu >= 0.25), 2.0, mu >= 0.5);
|
||
|
float coord_y = ((angle * 4.0 + strength) * 3.0 + coherence + 0.5) / 288.0;
|
||
|
vec4 res = vec4(0.0), w;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.038461538461538464, coord_y));
|
||
|
res += luma0 * w + luma24 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.11538461538461539, coord_y));
|
||
|
res += luma1 * w + luma23 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.19230769230769232, coord_y));
|
||
|
res += luma2 * w + luma22 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.2692307692307692, coord_y));
|
||
|
res += luma3 * w + luma21 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.34615384615384615, coord_y));
|
||
|
res += luma4 * w + luma20 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.4230769230769231, coord_y));
|
||
|
res += luma5 * w + luma19 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.5, coord_y));
|
||
|
res += luma6 * w + luma18 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.5769230769230769, coord_y));
|
||
|
res += luma7 * w + luma17 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.6538461538461539, coord_y));
|
||
|
res += luma8 * w + luma16 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.7307692307692307, coord_y));
|
||
|
res += luma9 * w + luma15 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.8076923076923077, coord_y));
|
||
|
res += luma10 * w + luma14 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.8846153846153846, coord_y));
|
||
|
res += luma11 * w + luma13 * w.wzyx;
|
||
|
w = texture(ravu_lite_lut3, vec2(0.9615384615384616, coord_y));
|
||
|
res += luma12 * w;
|
||
|
res = clamp(res, 0.0, 1.0);
|
||
|
return res;
|
||
|
}
|
||
|
//!DESC RAVU-Lite (step2, r3)
|
||
|
//!HOOK LUMA
|
||
|
//!BIND HOOKED
|
||
|
//!BIND ravu_lite_int
|
||
|
//!WIDTH 2 HOOKED.w *
|
||
|
//!HEIGHT 2 HOOKED.h *
|
||
|
//!WHEN HOOKED.w OUTPUT.w / 0.707106 < HOOKED.h OUTPUT.h / 0.707106 < *
|
||
|
//!COMPONENTS 1
|
||
|
vec4 hook() {
|
||
|
vec2 dir = fract(HOOKED_pos * HOOKED_size) - 0.5;
|
||
|
int idx = int(dir.x > 0.0) * 2 + int(dir.y > 0.0);
|
||
|
return vec4(ravu_lite_int_texOff(-dir)[idx], 0.0, 0.0, 0.0);
|
||
|
}
|
||
|
//!TEXTURE ravu_lite_lut3
|
||
|
//!SIZE 13 288
|
||
|
//!FORMAT rgba16f
|
||
|
//!FILTER NEAREST
|
||
|
d8b8c339ab9780b831e9aeb810cfa4b91782da3922bf67bb9bb1603b7ef86639ce52373bc9b3333bfcd11f3b3ce91e3b433e6abbe7c23b3a81956338ac065b3b5b5927b96c56eb39fcccb5b9258016b88813bd3a9a38793b0a1b86bbdce729ba413b023db08e35bc244447bc10cbbebb5a82a03d19ef9f3d870d01bef04801bea69d32bcaae7013d5bedbabb04684bbc2963753b9033d23a4e0d35ba8b5189bbeb70633b13fbff3af286483b8daafc3a61529f3deca800bed2069f3d42de00be63808a3f00768a3f00768a3f63808a3f2cbb89b9b94a943808a23f3912d006b9e769fdba382898bb9baab43bc1d6e63acbc024ba354748ba73f9b63b2f83c73bf7b193bb8e41dfba5597df3a7705aa3b396ca638bae278b826b988b920400a398ccb243b89cec33b4f38b5bb77080ebbc7af1a3d282424bca8ef71bc4f5f1fbc789aab3d1b39ab3d9e7306bef86a06be863223bcbef41c3d6e2224bc597579bcec85e13ba92d293bc44a33bbcf41c5bb6852d93a30089e3b5dc2113aa159533be002a93d15cd04beb6fca63dc22c06be58668a3f5e5f8a3f5e5f8a3f58668a3fe65bc9b9c883b338dec198b9c4a7ce39bca248bba70b9fbb49cccf3bead31b3b9057b2bb5f31b9bb6e61123c4259163c3830cabb5b016dbb0926723bf882ec3bdce743b9e717feb96f630e3aac3a5eb778eeef395decc93b1f2fafbb8e6a38b96aa03c3d70ce0dbcc9cf67bc172f8cbc8ac9b53d9bc2b33d5da90abe0d3609bef0118abbee34493d6377adbc8b3798bcc3c8163ca0f9693b380e76bba6dc09bc8eea68ba4d9d1b3cb7b8c3bb69f9853be624c33d5b1c0bbe14e4b33d47a712be72178a3f7b738a3f7b738a3f72178a3ff6df70b625f7cab86ccf24b8709bbeb963887ebbb7a698bb6216fd3b31b97d3aa65c1cbcef8b3dbc17488c3c6a6c833c9a9cc7bb47fc56bb54df353af38e113cd957f439f6ef87b9f18fdeb9efad54b929d91fbb35541a3c18bdc8bb6c3c6aba9f20233dc6ce95bc6e4daabcbca2553b7d28f03dbfb6e93d6cce25bec14d26bec00496bc5a5b333dfe7d1c3a4149b7bc90001c3ce0a124bb087e86b9df88debb400f28bcfb71903c487a36bc90fa8a3cc2e7f93d3f8b2abecda0f03ded502cbeb4ce893feb268a3feb268a3fb4ce893f6e189d39fd806bb9cba1823950473eba19af8fbb7be605bb9e3ca23b3d32b63a150d27bcb7842fbc9cad863c01957e3cf64a94bb7fd9a0bb000b293be704e93b08a97c37cc7ac4b97fe67bb9fc2ca2390f725abb95cf123cf298aebba94179b9115f1e3d18b8a0bcc96d9fbc63e5a93b9954e93db81ede3dd4b020beb44b20be6ba875bcabfe3e3d29a11bbbe908d0bcdfb14c3c1d01873aa9a572bb0fa023bce7c8e7bbcc6ea83c267d6cbcc2e9633cd7ef033e11242abedd92ed3d533d33befb90893f84528a3f84528a3ffb90893fe8da2d3a4051b93973b400ba223159ba2c4392bb1a260abb47046d3b3868483b562de3bb94bfdfbbb728393c65ea213ced3cb9bbc258c4bb9430a83bbf97f43bdf15cd38e8f8afb956021b3988a899b80b1eeabb0ab5bd3aa0576f3a5d10cb3bec3a163d07de96bc979574bc0b70473b38bace3d48fbc13d3ae112be42cd10be27aeb4bb465e543d4b3b48bc0bc0f1bc7b3ca23cc6063e3cb39355bcef5997bcc0c0453c4b6ce33c5295b5bc723ef5bbde29fc3d9b3c19bebc17ca3da79e2ebe5c99893feb818a3feb818a3f5c99893fde5d30ba1d7c27b9cf2f07b84aeb3238c6ca9dba2e7611bb3c84dd3b6fb368bbf3f3c2bcd0cfb7bc3a7cf63c184bf33c0a9152bbf3064dbb6631dbba6e11053c0dfd20b9891360baa00ebeb80e547d3922ec99b9047a373c7857aabb2127cabb12d9fd3c7ba1ccbc627bb6bccc24a53c0265173e7e9a0e3e44c841bea9d140be3ed2ccbca2ea283dc69c5a3ca16dd7bc032e533c35481cbac2e5adbb8596f0bbc746cabcf3ec083d349fd7bcb81d043daa3a223e1a2549be7d01163e887e4dbe790d893fd3208a3fd3208a3f790d893ff3d5e7397269b4babb60763a03e90fbacf96e9baf0e1073bdafd033b4e7a2dbbc05489bc9e6184bc92bdbd3cc68cb03c6e9ebcba759d88bbc65e13b9c60bc83b880103bb0bd5c3ba531d753ae9b50b3bf3e917baeacb1d3c18495fbb1791d3bba440b33c788ad4bcbf158cbcafecd03cc0a0073eaf9af03d29612dbe253d2cbe79da9ebc78e9343d4295073c7794fabc6e2b9f3c8184d03bd31455bc803562bce78194bc9cce223d2c5f04bdd9dccc3cbf322d3e449f44bec0c50e3e93bb55be7aa1883f5f868a3f5f868a3f7aa1883f1f58c237b333bfbaaecab33a287a30b9a86ae63767c05c3b8f4f10bb7fd1b5ba6b5df6bb0cab03bcff504b3ccbd3293cb11d36ba65018cbade4d823a289ed73a3ccc99bbdcb99ebbc2528d3bcec8b73bbcc07fbc44add7bb6a2f313cf03e4e3ca76f533b388d20bd217cb73bb9be143d2993da3d49b2c23d96a914be6e4310bef8ee59bbc36e383d884de1bbc2db08bd4bf9443d406d293d2b8e2fbd3ff74abdfa88103d9fc28e3d5f3b87bd0c29d9bc3de42f3e20761ebe8da3d83d1f1f5ebe71d5883fc6a88a3fc6a88a3f71d5883f0104f13909470ebbacb30d3a86685fb802fe6bbbab842d3b1f9afa3b19dce8bb719514bd32b60dbde74f313debf1313dfb2f1db9af89f1bb5b7c28bbe44d273c79c122bbdafa18ba7b5cab368e17f33a4499abbaa162633c97a411bb41492ebc0f0fef3c8e01e4bc7febfabcac75073d70972e3ef6681f3e646156bee0f255be3821debc78c0433d4d5ea93c2e2e1dbdc4c98f3cbab947bbda6412bc1165b9bb593916bd0e57393d5b7614bdb829323
|