Noise vertex displacement

Basic vertex displacement shader that uses an OpenSimplexNoise to randomly displace vertices on a plane.

Instructions

  1. Add a new MeshInstance and make it a Plane mesh in the Inspector.
  2. Subdivide the plane by setting Subdivide width and Subdivide depth to 32.
  3. Add a new NoiseTexture to the Displacement shader parameter and add a new OpenSimplexNoise to Noise.
  4. 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;
}
Tags
displacement, noise, openSimplexNoise, vertex

More from godotshaders

Cloudy skies

Simple 2D dissolve

Realistic Water

Related shaders

Noise Laser

Screen Noise Effect Shader

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.
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
SamWise
SamWise
3 months ago

This help a lot thanks 🙂 also… do you know how to apply color/texture to this?