Noise vertex displacement
Basic vertex displacement shader that uses an OpenSimplexNoise to randomly displace vertices on a plane.
Instructions
- Add a new MeshInstance and make it a Plane mesh in the Inspector.
- Subdivide the plane by setting Subdivide width and Subdivide depth to 32.
- Add a new NoiseTexture to the Displacement shader parameter and add a new OpenSimplexNoise to Noise.
- Edit the height with Height Scale.
Shader code
shader_type spatial;
uniform float height_scale = 0.5;
uniform sampler2D displacement;
varying vec2 tex_position;
void vertex() {
tex_position = VERTEX.xz / 2.0 + 0.5;
float height = texture(displacement, tex_position).x;
VERTEX.y += height * height_scale;
}
This help a lot thanks 🙂 also… do you know how to apply color/texture to this?
You would have to do that in the shaders fragment function. Here is an explanation from Godot official documentation of how to do that https://docs.godotengine.org/en/3.0/tutorials/3d/vertex_displacement_with_shaders.html#fragment-shader