Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader Vignette Godot 4 (ColorRect)
- shader_type canvas_item;
- uniform float alpha : hint_range(0.0, 1.0) = 1.0;
- uniform float inner_radius : hint_range(0.0, 1.0) = 0.0;
- uniform float outer_radius : hint_range(0.0, 1.0) = 1.0;
- uniform vec4 vignette_color : source_color = vec4(0.0, 0.0, 0.0, 1.0);
- void fragment() {
- float x = abs(UV.x - 0.5) * 2.0;
- float y = abs(UV.y - 0.5) * 2.0;
- float q = 1.0 - (1.0 - sqrt(x * x + y * y) / outer_radius) / (1.0 - inner_radius);
- // Multiplica a cor pelo alpha calculado
- COLOR = vec4(vignette_color.rgb, vignette_color.a * q * alpha);
- }
Advertisement
Add Comment
Please, Sign In to add comment