use high on painting shaders
This commit is contained in:
@@ -24,41 +24,41 @@ void main()
|
||||
#include "include/color.glsl"
|
||||
#include "include/blend-stroke.glsl"
|
||||
|
||||
uniform mediump sampler2D tex;
|
||||
uniform mediump sampler2D tex_bg;
|
||||
uniform mediump sampler2D tex_mix;
|
||||
uniform mediump vec4 col;
|
||||
uniform mediump vec2 resolution;
|
||||
uniform mediump float alpha;
|
||||
uniform mediump float opacity;
|
||||
uniform mediump float noise;
|
||||
uniform mediump float mix_alpha;
|
||||
uniform mediump float wet;
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D tex_bg;
|
||||
uniform sampler2D tex_mix;
|
||||
uniform highp vec4 col;
|
||||
uniform highp vec2 resolution;
|
||||
uniform highp float alpha;
|
||||
uniform highp float opacity;
|
||||
uniform highp float noise;
|
||||
uniform highp float mix_alpha;
|
||||
uniform highp float wet;
|
||||
|
||||
uniform bool use_pattern;
|
||||
uniform mediump sampler2D tex_pattern;
|
||||
uniform mediump vec2 pattern_scale;
|
||||
uniform mediump float pattern_bright;
|
||||
uniform mediump float pattern_contr;
|
||||
uniform mediump float pattern_depth;
|
||||
uniform mediump vec2 pattern_offset;
|
||||
uniform sampler2D tex_pattern;
|
||||
uniform highp vec2 pattern_scale;
|
||||
uniform highp float pattern_bright;
|
||||
uniform highp float pattern_contr;
|
||||
uniform highp float pattern_depth;
|
||||
uniform highp vec2 pattern_offset;
|
||||
uniform bool pattern_invert;
|
||||
uniform int patt_blend_mode;
|
||||
|
||||
in mediump vec2 uv;
|
||||
in mediump vec2 uv_2;
|
||||
in mediump float q;
|
||||
in highp vec2 uv;
|
||||
in highp vec2 uv_2;
|
||||
in highp float q;
|
||||
#if defined(GL_EXT_shader_framebuffer_fetch)
|
||||
inout mediump vec4 frag;
|
||||
inout highp vec4 frag;
|
||||
#else
|
||||
out mediump vec4 frag;
|
||||
out highp vec4 frag;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
mediump vec2 uv2 = gl_FragCoord.st / resolution;
|
||||
mediump float brush_alpha = ( 1.0 - texture(tex, uv/q).r ) * alpha;
|
||||
mediump vec4 fg = vec4(col.rgb, brush_alpha);
|
||||
highp vec2 uv2 = gl_FragCoord.st / resolution;
|
||||
highp float brush_alpha = ( 1.0 - texture(tex, uv/q).r ) * alpha;
|
||||
highp vec4 fg = vec4(col.rgb, brush_alpha);
|
||||
|
||||
// early discard
|
||||
if (fg.a == 0.0)
|
||||
@@ -66,8 +66,8 @@ void main()
|
||||
|
||||
if (use_pattern)
|
||||
{
|
||||
mediump vec2 rscale = resolution / vec2(512.0);
|
||||
mediump float patt = texture(tex_pattern, uv2 * (1.0 / pattern_scale) * rscale + pattern_offset).r;
|
||||
highp vec2 rscale = resolution / vec2(512.0);
|
||||
highp float patt = texture(tex_pattern, uv2 * (1.0 / pattern_scale) * rscale + pattern_offset).r;
|
||||
if (pattern_invert)
|
||||
patt = 1.0 - patt;
|
||||
patt = patt * pattern_depth + (1.0 - pattern_depth);
|
||||
@@ -79,11 +79,11 @@ void main()
|
||||
}
|
||||
|
||||
#if defined(GL_EXT_shader_framebuffer_fetch)
|
||||
mediump vec4 bg = frag;
|
||||
highp vec4 bg = frag;
|
||||
#elif defined(GL_ARM_shader_framebuffer_fetch)
|
||||
mediump vec4 bg = gl_LastFragColorARM;
|
||||
highp vec4 bg = gl_LastFragColorARM;
|
||||
#else
|
||||
mediump vec4 bg = texture(tex_bg, uv2);
|
||||
highp vec4 bg = texture(tex_bg, uv2);
|
||||
#endif
|
||||
|
||||
fg.a *= 1.0-rand(uv2+uv)*noise;
|
||||
@@ -94,17 +94,17 @@ void main()
|
||||
|
||||
if (mix_alpha > 0.0)
|
||||
{
|
||||
mediump vec2 uv_mix = uv_2 / q;
|
||||
highp vec2 uv_mix = uv_2 / q;
|
||||
if (uv_mix.x < 0.0 || uv_mix.x > 1.0 || uv_mix.y < 0.0 || uv_mix.y > 1.0) discard;
|
||||
mediump vec4 mbg = texture(tex_mix, uv_mix);
|
||||
highp vec4 mbg = texture(tex_mix, uv_mix);
|
||||
fg.rgb = mix(fg.rgb, mbg.rgb, mix_alpha * mbg.a);
|
||||
}
|
||||
|
||||
mediump float contribution = max(0.0, opacity - bg.a) * fg.a;
|
||||
mediump float alpha_tot = bg.a + contribution;
|
||||
mediump vec3 rgb = mix(bg.rgb, fg.rgb, clamp(fg.a / alpha_tot, 0.0, 1.0));
|
||||
mediump vec4 frag_wet = vec4(rgb, max(bg.a, fg.a * 1.2));
|
||||
mediump vec4 frag_dry = vec4(rgb, alpha_tot);
|
||||
highp float contribution = max(0.0, opacity - bg.a) * fg.a;
|
||||
highp float alpha_tot = bg.a + contribution;
|
||||
highp vec3 rgb = mix(bg.rgb, fg.rgb, clamp(fg.a / alpha_tot, 0.0, 1.0));
|
||||
highp vec4 frag_wet = vec4(rgb, max(bg.a, fg.a * 1.2));
|
||||
highp vec4 frag_dry = vec4(rgb, alpha_tot);
|
||||
frag = mix(frag_dry, frag_wet, wet);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user