From aa6db0aa944ae06c66e604704b9a31d84b75f71b Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Sun, 25 Jun 2023 12:38:05 +0200 Subject: [PATCH] add fade slider to enable/disable fading --- data/ofxMsdfgen/shaders/mix/ES3/shader.frag | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/ofxMsdfgen/shaders/mix/ES3/shader.frag b/data/ofxMsdfgen/shaders/mix/ES3/shader.frag index 7580689..46a83d6 100644 --- a/data/ofxMsdfgen/shaders/mix/ES3/shader.frag +++ b/data/ofxMsdfgen/shaders/mix/ES3/shader.frag @@ -4,6 +4,7 @@ precision highp float; // these are our textures uniform sampler2D msdf; +uniform float fade; uniform vec2 unitRange; uniform vec4 bgColor; @@ -32,7 +33,7 @@ float screenPxDistance(vec3 msdf_rgb, vec2 uv) { } float near = 1.0; -float far = 4600.0; +float far = 4400.0 + 400.0; float width = 1920.0; float height = 1080.0; float linearizeDepth(float depth) @@ -77,9 +78,10 @@ void main() )); // INFO: this needs to be adjusted if field of view is adjusted float d = smoothstep(0.2, 0.8, z + 0.2 * (screenPos.x + screenPos.y)); + d = min(d, fade); outputColor = vec4(mix(fgColor.rgb, backgroundColor.rgb, d),1.0); //outputColor = vec4(opacity, 1.0-opacity, 0.0, 1.0); - //outputColor = vec4(1.0-msdf_rgb.rgb, 1.0); + //outputColor = vec4(1.0-msdf_rgb_a.rgb, 1.0); //outputColor = vec4(1.0,0.0,1.0,1.0); }