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;
}
Tags
#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

3D Bubble/Spatial shield shader

Ripple Gradient Shaderww

Ripple Gradient Shader

Related shaders

far distance water shader (sea shader)

CRT shader

Perfect Retro Pixel Shader – Godot 4

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments