Created
January 13, 2026 11:53
-
-
Save anthonyec/ada78b9c64040f96c6958072ead589b7 to your computer and use it in GitHub Desktop.
Stripes Godot Shader
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 vec4 stripe_color: source_color = vec4(0.2, 0.2, 0.2, 1.0); | |
| uniform vec4 gap_color: source_color = vec4(0.0, 0.0, 0.0, 1.0); | |
| uniform float angle_degrees = 45.0; | |
| uniform float gap_width : hint_range(0.0, 999.0, 1.0) = 2.0; | |
| uniform float stripe_width : hint_range(0.0, 999.0, 1.0) = 4.0; | |
| void fragment() { | |
| float angle = radians(angle_degrees); | |
| float pixel = cos(angle) * FRAGCOORD.x + sin(angle) * FRAGCOORD.y; | |
| float step_size = gap_width + stripe_width; | |
| float pixel_mod = mod(pixel, step_size); | |
| float is_stripe = step(gap_width, pixel_mod); | |
| float alpha = COLOR.w; | |
| COLOR = mix(gap_color, stripe_color, is_stripe) * alpha; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment