Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shader_type spatial;
- // Show rear-facing grass
- render_mode cull_disabled, world_vertex_coords;
- // Grass Colour Shader
- uniform vec3 colour: source_color;
- uniform vec3 colour2: source_color;
- uniform sampler2D noise2;
- uniform float noiseScale = 20.0;
- varying vec3 worldPos;
- // Godot Simple Wind Vertex Shader
- group_uniforms wind;
- uniform sampler2D noise_tex;
- uniform float wind_speed = .1;
- uniform float wind_strength = .2;
- void vertex() {
- // Called for every vertex the material is visible on.
- worldPos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
- float offset = TIME * wind_speed;
- float noise = texture(noise_tex, NODE_POSITION_WORLD.xz-offset).r;
- noise -= .5;
- noise *= wind_strength;
- VERTEX.x += noise * length(VERTEX.y - NODE_POSITION_WORLD.y) * length(VERTEX.xz);
- }
- void fragment() {
- // Called for every pixel the material is visible on.
- vec3 noiseLevel = texture(noise2, worldPos.xz / noiseScale).rgb;
- ALBEDO = mix(colour, colour2, UV.y) * mix(colour, colour2, noiseLevel.r);
- if (!FRONT_FACING) {
- NORMAL = -NORMAL;
- }
- }
- //void light() {
- // Called for every pixel for every light affecting the material.
- // Uncomment to replace the default light processing function with this one.
- //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement