Advertisement
Guest User

Untitled

a guest
Mar 30th, 2014
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #version 120
  2.  
  3. varying vec4 color;
  4. varying vec4 texcoord;
  5. varying vec4 lmcoord;
  6.  
  7. attribute vec4 mc_Entity;
  8.  
  9. uniform float frameTimeCounter;
  10.  
  11. void main() {
  12.  
  13. texcoord = gl_TextureMatrix[0] * gl_MultiTexCoord0;
  14.  
  15. //Uniform random direction using equal-area projection
  16. float noisep = clamp(fract(sin(dot(gl_Vertex ,vec4(12.9898f,78.233f,16.5f,0.0f))) * 43758.5453f),0.0f,1.0f)*6.2831853f;
  17. float noisez = clamp(fract(sin(dot(gl_Vertex, vec4(16.5f, 12.9898f,78.233f,0.0f))) * 43758.5453f),0.0f,1.0f)*2.0f-1.0f;
  18. float k = sqrt(1-noisez*noisez);
  19. vec4 dir = vec4(k*cos(noisep), k*sin(noisep), noisez, 0.0f);
  20.  
  21. //Box-Muller method to generate normal variates
  22. float noise3 = clamp(fract(sin(dot(gl_Vertex, vec4(12.9898f,16.5f, 78.233f,0.0f))) * 43758.5453f),0.0f,1.0f);
  23. float noise4 = clamp(fract(sin(dot(gl_Vertex, vec4(16.6f, 16.6f,16.6f,0.0f))) * 43758.5453f),0.0f,1.0f);
  24. float normv = sqrt(-2.0f * log(noise3)) * sin(6.2831853f*noise4);
  25. float scale = clamp(normv*0.33f,-1.0f,1.0f)*0.8; //increase last number for greater effect
  26.  
  27. vec4 position = gl_ModelViewMatrix * (gl_Vertex + dir*scale);
  28.  
  29. gl_Position = gl_ProjectionMatrix * position; //Update position of matrix
  30.  
  31. color = gl_Color;
  32.  
  33. lmcoord = gl_TextureMatrix[1] * gl_MultiTexCoord1;
  34.  
  35. gl_FogFragCoord = gl_Position.z;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement