Newer
Older
DungeonShooting / DungeonShooting_Godot / resource / material / Sawtooth.gdshader
@小李xl 小李xl on 27 Nov 2023 392 bytes 液体边缘平滑效果
  1. shader_type canvas_item;
  2.  
  3. void vertex() {
  4. VERTEX = VERTEX * vec2(4.0);
  5. }
  6.  
  7. void fragment() {
  8. vec2 pixel_size = 1.0 / vec2(textureSize(TEXTURE, 0));
  9. vec4 color = vec4(0.0);
  10. for (int x = -1; x <= 1; x++) {
  11. for (int y = -1; y <= 1; y++) {
  12. color += texture(TEXTURE, UV + vec2(float(x), float(y)) * pixel_size / 2.0);
  13. }
  14. }
  15. color /= 9.0;
  16. COLOR = color;
  17. }
  18.