// 3d noise and turbulence vertex shader // vertex to fragment communication for noise shaders varying vec3 Nin; void main() { // compute diffuse lighting vec3 nn = normalize(gl_NormalMatrix*gl_Normal); vec3 nl = normalize(vec3(-1,1,1)); gl_FrontColor = max(vec4(0,0,0,1),dot(nn,nl))*vec4(.9,.7,.5,0) + vec4(.1,.14,.18,1); // transform vertices into projection space using the pre-multiplied matrix gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; // compute scaled noise inputs Nin = gl_Vertex.xyz*.1; }