Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2013 14:20
Show Gist options
  • Save anonymous/5850396 to your computer and use it in GitHub Desktop.
Save anonymous/5850396 to your computer and use it in GitHub Desktop.
aurora borealis vertex shader
uniform mat4 mvp;
uniform float t;
varying vec2 tc;
varying vec3 col;
varying vec3 p;
void main()
{
//gl_Position = mvp * gl_Vertex;
float freq = 0.02;
float amp = 30;
p = gl_Vertex.xyz;
float xfactor = clamp(sin( gl_MultiTexCoord0.x * 3.14159), 0.0, 1.0);
float amplitude = cos( (t*2.0 + gl_MultiTexCoord0.x) * 0.05 )*amp;
float normFactor = cos( (p.x) * freq + t)* amplitude * xfactor;
p += vec3( 0.0, 0.0, normFactor );
gl_Position = mvp * vec4( p, 1.0);
col = vec3(xfactor, 1.0-gl_MultiTexCoord0.y, normFactor);
tc = gl_MultiTexCoord0.xy;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment