Created
February 19, 2024 15:09
-
-
Save MrBSmith/815480912303d55b15155dfaf06b4d5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shader_type canvas_item; | |
uniform float row_offset : hint_range(0.0, 1.0, 0.01); | |
uniform vec2 direction = vec2(0.77, 0.77); | |
uniform float speed = 10.0; | |
uniform float skew_amount : hint_range(-1.0, 1.0, 0.01) = 0.5; | |
uniform float perspective_amount = -0.5; | |
void fragment() { | |
float scale = 1.0; | |
vec2 move_uv = UV + direction * TIME * speed; | |
vec2 pick_uv = vec2(move_uv.x, move_uv.y + (move_uv.x * skew_amount)) / vec2(scale + ((UV.x - 0.5) * perspective_amount)); | |
int row_id = int(pick_uv.y); | |
if (row_id % 2 != 0) { | |
pick_uv += vec2(row_offset, 0.0); | |
} | |
vec4 texture_color = texture(TEXTURE, pick_uv); | |
COLOR = texture_color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment