New update:
- Added Paint filter. - Tweaked order of shaders. - Allow more grain parameters to be configured.
This commit is contained in:
parent
236911f269
commit
595159703c
11 changed files with 259 additions and 67 deletions
33
shaders/glsl/mfx_paint_pass2.fp
Normal file
33
shaders/glsl/mfx_paint_pass2.fp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Paint filter from MariENB (second pass median smoothing)
|
||||
(C)2012-2021 Marisa Kirisame
|
||||
*/
|
||||
#define luminance(x) dot(x,vec3(0.2126,0.7152,0.0722))
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 coord = TexCoord;
|
||||
vec4 res = vec4(1.);
|
||||
vec2 bresl = textureSize(InputTexture,0);
|
||||
vec2 bof = 1./bresl;
|
||||
vec3 m1, m2, m3;
|
||||
vec3 a, b, c;
|
||||
a = texture(InputTexture,coord+vec2(-1,-1)*bof).rgb;
|
||||
b = texture(InputTexture,coord+vec2( 0,-1)*bof).rgb;
|
||||
c = texture(InputTexture,coord+vec2( 1,-1)*bof).rgb;
|
||||
m1 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
a = texture(InputTexture,coord+vec2(-1, 0)*bof).rgb;
|
||||
b = texture(InputTexture,coord+vec2( 0, 0)*bof).rgb;
|
||||
c = texture(InputTexture,coord+vec2( 1, 0)*bof).rgb;
|
||||
m2 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
a = texture(InputTexture,coord+vec2(-1, 1)*bof).rgb;
|
||||
b = texture(InputTexture,coord+vec2( 0, 1)*bof).rgb;
|
||||
c = texture(InputTexture,coord+vec2( 1, 1)*bof).rgb;
|
||||
m3 = (luminance(a)<luminance(b))?((luminance(b)<luminance(c))?b
|
||||
:max(a,c)):((luminance(a)<luminance(c))?a:max(b,c));
|
||||
res.rgb = (luminance(m1)<luminance(m2))?((luminance(m2)<luminance(m3))
|
||||
?m2:max(m1,m3)):((luminance(m1)<luminance(m3))?m1:max(m2,m3));
|
||||
FragColor = res;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue