diff options
author | hop311 <hop3114@gmail.com> | 2024-07-08 23:34:57 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2024-07-10 22:44:01 +0200 |
commit | 1496de8262b104ad7dd52b9f6e936fcd6ed1d384 (patch) | |
tree | 8e82ee10733a1f41cbf44063cd12d9bdc9bc7f63 /game/src/Game/Model/scrolling.gdshader | |
parent | d1ff26c46dbba3e373f5c71f7ed093b5cd9ca6a0 (diff) |
Scrolling model materials (tank tracks and smoke)scrolling-textures
Diffstat (limited to 'game/src/Game/Model/scrolling.gdshader')
-rw-r--r-- | game/src/Game/Model/scrolling.gdshader | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/game/src/Game/Model/scrolling.gdshader b/game/src/Game/Model/scrolling.gdshader new file mode 100644 index 0000000..c90ee19 --- /dev/null +++ b/game/src/Game/Model/scrolling.gdshader @@ -0,0 +1,19 @@ +shader_type spatial; + +// depth_prepass_alpha is to ensure opaque scrolling textures +// (e.g. tank tracks) are rendered correctly +render_mode cull_disabled, depth_prepass_alpha; + +uniform sampler2D scroll_texture_diffuse[32] : source_color, filter_linear_mipmap, repeat_enable; +uniform float scroll_factor[32]; + +instance uniform uint scroll_tex_index_diffuse; +instance uniform float scroll_speed; + +void fragment() { + vec2 uv_scrolled = UV; + uv_scrolled.y += TIME * scroll_speed * scroll_factor[scroll_tex_index_diffuse]; + + ALBEDO = texture(scroll_texture_diffuse[scroll_tex_index_diffuse], uv_scrolled).rgb; + ALPHA = texture(scroll_texture_diffuse[scroll_tex_index_diffuse], UV).a; +} |