Manipulate Vertices using GLSL shader

Hello, I’m working on adding a glsl shader code that will manipulate a mesh structure into my terrain generator, but I’ve run into the problem where I can’t manipulate a object on a per vertex basis, here is my vertex shader that I am using to manipulate my terrain, currently all it does is raise the terrain as a whole a certain height and not each individual vertex, any help is greatly appreciated :slight_smile:


VertexShader = """

varying vec4 position;
varying vec3 vnoise; 

// basic random noise generator (found online)
float rand(vec2 n)
  return 0.5 + 0.5 * 
     fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);

void main()
    // deform
    vec4 v = gl_Vertex;
    float x = rand(vnoise.xz);
    v.z = x;
    // display normals of terrain
    position = 0.5 * (gl_Vertex + vec4(1.0, 1.0, 1.0, 0.0));
    // update positions
    gl_Position = gl_ModelViewProjectionMatrix * v;

Solved the problem :slight_smile: instead of using rand(vnoise.xz) in the deform section of the code I use gl_Vertex.xy which manipulates the terrain as I want it to