 Very simple 3D falling leaf shader, couldn’t find it on here so I made it myself works by getting pseudo random values and rotating the mesh using some simple matrix maths. There is also a wind element that is dependent on index so leaves move slightly different. If your new to shaders remember to alter the variables in the time dropdown to change the shaders behaviour.

-Use local coordinates this doesn’t use global

``````shader_type particles;

//this defines how far out the particles will spawn
uniform float particle_diameter = 5f;

//input a value that changes over time and can also be a coordinate
//use vec(TIME,0) if you got no coordinates
float rand(vec2 co){
//this will give a pseudorandom value between 0-1
return fract(sin(dot(co.xy ,vec2(23.21,101.83))) * 34759.214);
}

void vertex(){
//this sets all the stuff necesary
//spawn them in a given radius around the emmitor
if(RESTART)
{

//set the position to be randomly dispersed in an area
float x_modifier = (rand(vec2(TIME,0))*particle_diameter);
float z_modifier = (rand(vec2(TIME+1f,0))*particle_diameter);

//centers effect
TRANSFORM = x_modifier - 0.5f*particle_diameter;
TRANSFORM = z_modifier- 0.5f*particle_diameter;

//VELOCITY.y = -rand(vec2(TIME+2f,0));
VELOCITY.y = -1f;
}

//apply a changing wind that changes with time with a noticable variation
VELOCITY.x = 3f*sin(TIME/4f)*sin(TIME)*rand(vec2(float(INDEX),0f));
VELOCITY.z = 3f*cos(TIME/4f)*cos(TIME)*rand(vec2(float(INDEX)+1f,0f));

//gives a consistent rotation that depends on the index
float x_rotation = TIME*rand(vec2(float(INDEX),0f));
float y_rotation = TIME*rand(vec2(float(INDEX)+1f,0f));
float z_rotation = TIME*rand(vec2(float(INDEX)+2f,0f));

//these just rotate the leaf using matrix math
//x rotation
TRANSFORM = cos(x_rotation);
TRANSFORM = -sin(x_rotation);
TRANSFORM = sin(x_rotation);
TRANSFORM = cos(x_rotation);
//y rotation
TRANSFORM = cos(y_rotation);
TRANSFORM = -sin(y_rotation);
TRANSFORM = sin(y_rotation);
TRANSFORM = cos(y_rotation);
//z rotation
TRANSFORM = cos(z_rotation);
TRANSFORM = -sin(z_rotation);
TRANSFORM = sin(z_rotation);
TRANSFORM = cos(z_rotation);

}``````
###### Tags
3d, leaf, Spatial  