Created
June 24, 2013 14:20
-
-
Save anonymous/5850396 to your computer and use it in GitHub Desktop.
aurora borealis vertex shader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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