Guest User

Untitled

a guest
May 3rd, 2013
45
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. uniform sampler2D glow;
  2. uniform sampler2D color;
  3. uniform vec3 sunpos;
  4. varying vec3 vertex;
  5.  
  6. void main()
  7. {
  8. vec3 V = normalize(vertex)*0.995;
  9. vec3 L = normalize(sunpos);
  10.  
  11. // Compute the proximity of this fragment to the sun.
  12.  
  13. float vl = dot(V, L);
  14. float sun = smoothstep(0.0, 1.0, (vl-0.970)*10.0);
  15. sun += smoothstep(0.0, 1.0, (vl-0.9947)*6000.0);
  16. //sun = clamp(sun,0.0,1.0);
  17.  
  18. // Look up the sky color and glow colors.
  19.  
  20. vec4 Kc = texture2D(color, vec2((L.z + 1.0) / 2.0, V.z));
  21. vec4 Kg = texture2D(glow, vec2((L.z + 1.0) / 2.0, vl))*vl;
  22.  
  23. // Combine the color and glow giving the pixel value.
  24.  
  25. gl_FragColor = vec4(Kc.rgb + Kg.rgb * Kg.a / 2.0, Kc.a)+vec4(Kg.rgb*sun,0.15);
  26. //gl_FragColor = vec4(sun);
  27. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×