add fade slider to enable/disable fading

This commit is contained in:
jrkb 2023-06-25 12:38:05 +02:00
parent cac1eb1527
commit aa6db0aa94

View file

@ -4,6 +4,7 @@ precision highp float;
// these are our textures // these are our textures
uniform sampler2D msdf; uniform sampler2D msdf;
uniform float fade;
uniform vec2 unitRange; uniform vec2 unitRange;
uniform vec4 bgColor; uniform vec4 bgColor;
@ -32,7 +33,7 @@ float screenPxDistance(vec3 msdf_rgb, vec2 uv) {
} }
float near = 1.0; float near = 1.0;
float far = 4600.0; float far = 4400.0 + 400.0;
float width = 1920.0; float width = 1920.0;
float height = 1080.0; float height = 1080.0;
float linearizeDepth(float depth) float linearizeDepth(float depth)
@ -77,9 +78,10 @@ void main()
)); ));
// INFO: this needs to be adjusted if field of view is adjusted // 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)); 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(mix(fgColor.rgb, backgroundColor.rgb, d),1.0);
//outputColor = vec4(opacity, 1.0-opacity, 0.0, 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); //outputColor = vec4(1.0,0.0,1.0,1.0);
} }