started working on a boss room.
This commit is contained in:
20
src/shaders/fire_light.gdshader
Normal file
20
src/shaders/fire_light.gdshader
Normal file
@@ -0,0 +1,20 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
|
||||
uniform float brightness_multiplier : hint_range(1.0, 10.0) = 3.0;
|
||||
|
||||
void fragment() {
|
||||
// 1. Get the color of the darkened floor behind the sprite
|
||||
vec4 background = texture(screen_texture, SCREEN_UV);
|
||||
|
||||
// 2. Get the shape/fading of your light texture
|
||||
// We use the 'r' channel or 'a' channel depending on your sprite
|
||||
float mask = texture(TEXTURE, UV).a;
|
||||
|
||||
// 3. Instead of adding white, we multiply the background pixels
|
||||
// This restores the original colors of your tiles
|
||||
vec3 light_effect = background.rgb * (1.0 + (mask * brightness_multiplier));
|
||||
|
||||
// 4. Output the result
|
||||
COLOR = vec4(light_effect, 1.0);
|
||||
}
|
||||
1
src/shaders/fire_light.gdshader.uid
Normal file
1
src/shaders/fire_light.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c40fb6mfe76g3
|
||||
Reference in New Issue
Block a user