Advertisement
Zunesha

Shader Vignette Godot 4 (ColorRect)

Sep 11th, 2024
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDScript 0.34 KB | Gaming | 0 0
  1. Shader Vignette  Godot 4 (ColorRect)
  2.  
  3. shader_type canvas_item;
  4.  
  5. uniform float alpha = 1.0;
  6. uniform float inner_radius = 0.0;
  7. uniform float outer_radius = 1.0;
  8.  
  9. void fragment() {
  10.     float x = abs(UV.r-.5)*2.0;
  11.     float y = abs(UV.g-.5)*2.0;
  12.     float q = 1.0-(1.0-sqrt(x*x+y*y)/outer_radius)/(1.0-inner_radius);
  13.     COLOR = vec4(0, 0, 0, q*alpha);
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement