Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type canvas_item;
- void fragment()
- {
- float Pi = 6.28318530718; // Pi*2
- // GAUSSIAN BLUR SETTINGS {{{
- float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)
- float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)
- float Size = 20.0; // BLUR SIZE (Radius)
- // GAUSSIAN BLUR SETTINGS }}}
- vec2 Radius = Size/(1.0 / SCREEN_PIXEL_SIZE).xy;
- // Normalized pixel coordinates (from 0 to 1)
- vec2 uv = FRAGCOORD.xy/(1.0 / SCREEN_PIXEL_SIZE).xy;
- // Pixel colour
- vec4 Color = texture(SCREEN_TEXTURE, uv);
- // Blur calculations
- for( float d=0.0; d<Pi; d+=Pi/Directions)
- {
- for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality)
- {
- Color += texture(SCREEN_TEXTURE, uv+vec2(cos(d),sin(d))*Radius*i);
- }
- }
- // Output to screen
- Color /= Quality * Directions - 15.0;
- Color.r/=1.5;
- Color.g/=1.5;
- Color.b/=1.5;
- COLOR = Color;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement