fx 13 sobel filter

This commit is contained in:
2025-11-09 21:24:15 +01:00
parent 800503bbad
commit d58b8c56a6
5 changed files with 48 additions and 15 deletions
+16 -7
View File
@@ -367,7 +367,7 @@ subroutine(fx_stage_sub) vec4 fx_12(vec2 vUV, sampler2D previous, sampler2D feed
vec3 c0 = texture(previous, uv0).xyz;
vec2 uv2 = uv1;
float k1 = pow(2, 10 - floor(pixel_size * 6));
float k1 = pow(2, 9 - floor(pixel_size * 5));
float p = 1 / k1;
uv2 = round(uv2 * k1) / k1;
vec3 c1 = mix(
@@ -458,10 +458,9 @@ subroutine(fx_stage_sub) vec4 fx_12(vec2 vUV, sampler2D previous, sampler2D feed
return fx_master(c0, cout, seed, m0);
}
// TODO FX 13
// FX 13 : Sobel
subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{
return fx_2(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start
vec2 uv0 = vUV.st;
@@ -470,10 +469,20 @@ subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feed
// controls
float sx = magic(f1, b1, seed + 10) * 2;
float sy = magic(f2, b2, seed + 20) * 2;
float disp = 0.005 * magic(f3, b3, seed + 30);
// logic
vec3 c0 = texture(previous, uv0).xyz;
vec3 c = c0;
const mat3x3 sobelx = {{-1, -2, -1}, {0, 0, 0}, {1, 2, 1}};
const mat3x3 sobely = {{-1, 0, 1}, {-2, 0, 2}, {-1, 0, 1}};
mat3x3 sobel = sobelx * sx + sobely * sy;
vec3 c = abs(kernel(previous, uv0, sobel, disp).xyz);
return fx_master(c0, c, seed, m0);
}
@@ -481,7 +490,7 @@ subroutine(fx_stage_sub) vec4 fx_13(vec2 vUV, sampler2D previous, sampler2D feed
// TODO FX 14
subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{
return fx_3(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
return fx_1(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start
vec2 uv0 = vUV.st;
@@ -501,7 +510,7 @@ subroutine(fx_stage_sub) vec4 fx_14(vec2 vUV, sampler2D previous, sampler2D feed
// TODO FX 15
subroutine(fx_stage_sub) vec4 fx_15(vec2 vUV, sampler2D previous, sampler2D feedback, int seed, vec3 b1, vec2 f1, vec3 b2, vec2 f2, vec3 b3, vec2 f3, vec3 m0)
{
return fx_4(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
return fx_2(vUV, previous, feedback, seed, b1, f1, b2, f2, b3, f3, m0);
// start
vec2 uv0 = vUV.st;