Advertisement
Guest User

Untitled

a guest
Mar 26th, 2024
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. shader_type canvas_item;
  2.  
  3. // High Pass Sharpening Filter
  4. // Adjust the strength to control the sharpness effect
  5. uniform sampler2D SCREEN_TEXTURE: hint_screen_texture, filter_linear;
  6. uniform float strength : hint_range(0.0, 10.0) = 1.0;
  7.  
  8. void fragment() {
  9.     vec2 uv = SCREEN_UV;
  10.    
  11.     vec2 step = SCREEN_PIXEL_SIZE;
  12.    
  13.     vec3 texA = texture( SCREEN_TEXTURE, uv + vec2(-step.x, -step.y) * 1.5 ).rgb;
  14.     vec3 texB = texture( SCREEN_TEXTURE, uv + vec2( step.x, -step.y) * 1.5 ).rgb;
  15.     vec3 texC = texture( SCREEN_TEXTURE, uv + vec2(-step.x,  step.y) * 1.5 ).rgb;
  16.     vec3 texD = texture( SCREEN_TEXTURE, uv + vec2( step.x,  step.y) * 1.5 ).rgb;
  17.    
  18.     vec3 around = 0.25 * (texA + texB + texC + texD);
  19.     vec3 center  = texture( SCREEN_TEXTURE, uv ).rgb;
  20.    
  21.     float sharpness = strength;
  22.    
  23.     vec3 col = center + (center - around) * sharpness;
  24.    
  25.     COLOR = vec4(col,1.0);
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement