Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/atmospheric_engine/shaders/cloud.frag @ 3876

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