From 7cf99cb510a8a41c1b256df8b2d7111d35561971 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Mon, 26 Feb 2024 17:02:48 -0500 Subject: [PATCH] ability to set background color in electricity shader --- shaders/electricity.gdshader | 2 ++ 1 file changed, 2 insertions(+) diff --git a/shaders/electricity.gdshader b/shaders/electricity.gdshader index 9f236b4..625d032 100644 --- a/shaders/electricity.gdshader +++ b/shaders/electricity.gdshader @@ -10,6 +10,7 @@ uniform vec4 arc_color : hint_color = vec4(1.0, 0.93, 0.0, 1.0); uniform float gamma = 2.0; uniform float flash_rate = 3.0; uniform float flash_intensity = 0.2; +uniform vec4 background_color : hint_color = vec4(0.0, 0.0, 0.0, 0.0); // Description : Array and textureless GLSL 2D/3D/4D simplex // noise functions. @@ -118,6 +119,7 @@ void fragment() { } else { vec4 tex_color = texture(TEXTURE, UV); tex_color.rgb = pow(tex_color.rgb, vec3(1.0 / (gamma + sin(fract(TIME * floor(flash_rate)) * TAU) * flash_intensity))); + tex_color.rgb = mix(tex_color.rgb, background_color.rgb, background_color.a); // tex_color.rgb = pow(tex_color.rgb, vec3(0.5 + sin(TIME * 20.0) * 0.1)); // tex_color.rgb = pow(tex_color.rgb, vec3(1.0 / 2.0)); // tex_color.rgb += (round(sin(TIME * 20.0) * 4.0)) * 0.25 * 0.05;