diff options
author | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
---|---|---|
committer | Gone2Daly <71726742+Gone2Daly@users.noreply.github.com> | 2023-07-22 21:05:42 +0200 |
commit | 71b3cd829f80de4c2cd3972d8bfd5ee470a5d180 (patch) | |
tree | b4280fde6eef2ae6987648bc7bf8e00e9011bb7f /game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader | |
parent | ce9022d0df74d6c33db3686622be2050d873ab0b (diff) |
init_testtest3d
Diffstat (limited to 'game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader')
-rw-r--r-- | game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader b/game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader new file mode 100644 index 0000000..f8a05c5 --- /dev/null +++ b/game/addons/zylann.hterrain/tools/brush/shaders/alpha.gdshader @@ -0,0 +1,19 @@ +shader_type canvas_item; +render_mode blend_disabled; + +uniform sampler2D u_src_texture; +uniform vec4 u_src_rect; +uniform float u_opacity = 1.0; +uniform float u_value = 1.0; + +vec2 get_src_uv(vec2 screen_uv) { + vec2 uv = u_src_rect.xy + screen_uv * u_src_rect.zw; + return uv; +} + +void fragment() { + float brush_value = u_opacity * texture(TEXTURE, UV).r; + + vec4 src = texture(u_src_texture, get_src_uv(SCREEN_UV)); + COLOR = vec4(src.rgb, mix(src.a, u_value, brush_value)); +} |