Rev | Line | |
---|
[3876] | 1 | // |
---|
[3825] | 2 | // Fragment shader for producing animated clouds (mostly cloudy) |
---|
[3876] | 3 | // |
---|
| 4 | // Author: Randi Rost |
---|
| 5 | // |
---|
| 6 | // Copyright (c) 2002-2004 3Dlabs Inc. Ltd. |
---|
| 7 | // |
---|
| 8 | // See 3Dlabs-License.txt for license information |
---|
| 9 | // |
---|
[3825] | 10 | |
---|
| 11 | varying float LightIntensity; |
---|
| 12 | varying vec3 MCposition; |
---|
| 13 | |
---|
| 14 | uniform sampler3D Noise; |
---|
| 15 | uniform vec3 SkyColor; // (0.0, 0.0, 0.8) |
---|
| 16 | uniform vec3 CloudColor; // (0.8, 0.8, 0.8) |
---|
| 17 | uniform vec3 Offset; // updated each frame by the application |
---|
| 18 | |
---|
| 19 | void main (void) |
---|
| 20 | { |
---|
[3876] | 21 | vec4 noisevec = texture3D(Noise, MCposition + Offset); |
---|
[3825] | 22 | |
---|
[3876] | 23 | float intensity = (noisevec[0] + noisevec[1] + |
---|
| 24 | noisevec[2] + noisevec[3]) * 1.5; |
---|
[3825] | 25 | |
---|
[3876] | 26 | vec3 color = mix(SkyColor, CloudColor, intensity) * LightIntensity; |
---|
[3825] | 27 | |
---|
[3876] | 28 | gl_FragColor = vec4 (color, 1.0); |
---|
[3875] | 29 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.