fix frag shader

This commit is contained in:
Quinten Mennen 2025-06-11 19:17:43 +02:00
parent 38e7d27b2e
commit 280d1ac498

View File

@ -134,13 +134,14 @@ void main()
float r = texture(Texture1, distortedCoord + vec2(offset * 5, 0.0)).r;
float g = texture(Texture1, distortedCoord + vec2(0.0, offset * 2.0)).g;
float b = texture(Texture1, distortedCoord - vec2(offset, 0.0)).b;
vec3 color = vec3(r, g, b);
float a = texture(Texture1, distortedCoord).a;
vec4 color = vec4(r, g, b, a);
vec3 noisyColor = mix(color.rgb, vec3(noise, noise2, noise3), (strength / 2 + .2));
vec4 noisyColor = vec4(mix(color.rgb, vec3(noise, noise2, noise3), (strength / 2 + .2)), color.a);
float flicker = (1 - strength * 0.5) + 0.25 * (strength * sin(GameTime + sin(GameTime * 7.0) + 1));
float dim = u_battery < 0.1 ? u_battery * 10.0 : 1;
noiseColor = vec4(noisyColor, texColor.a * flicker * dim);
noiseColor = vec4(noisyColor.rgb, noisyColor.a * flicker * dim);
if (u_hit_timer > 0.0) {
vec2 uv = gl_FragCoord.xy / u_resolution.xy;
uv *= 1.0 - uv.yx;
@ -152,7 +153,6 @@ void main()
float mask = calculateMask(gl_FragCoord.xy / u_resolution, u_battery, 0.08f, 0.02f);
FragColor = vec4(noiseColor.rgb * mask, noiseColor.a);
// FragColor = noiseColor;
} else {
FragColor = texColor;
}