Bush Shader Code

This shader allows the movement of a bush sprite in various parameters. 

– I have attached a demo project that has other shaders i will add. 

Shader code
shader_type canvas_item;

uniform float amplitude : hint_range(0.0, 1.0) = 0.1;
uniform float frequency : hint_range(0.0, 10.0) = 2.0;
uniform float speed : hint_range(0.0, 10.0) = 1.0;
uniform bool enable_sway_x = false;
uniform float sway_x_amplitude : hint_range(0.0, 1.0) = 0.1;

void vertex() {
    float swayAmountY = amplitude * sin(TIME * frequency + VERTEX.y * speed);
    float swayAmountX = 0.0;
    if (enable_sway_x) {
        swayAmountX = sway_x_amplitude * sin(TIME * frequency + VERTEX.x * speed);

    VERTEX.y += swayAmountY;
    VERTEX.x += swayAmountX;
#2d #pixel art
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from Miisannn

Ripple Gradient Shader

Ripple Gradient Shader

Related shaders

World Normal Mix Shader

Palette Limiter Shader

Animated TV-Static Border Shader

Notify of

Inline Feedbacks
View all comments