ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/clouds.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 2 months ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 {
2 Compute fractal clouds over image
3
4 Greg Ward 11/1/95
5
6 Needs also noise2.cal
7
8 Usage:
9 pcomb -f noise2.cal -f clouds.cal planet.pic > cloudy.pic
10
11 Typically, this will be used to add clouds to Earth.pic or
12 bigEarth.pic in the standard library distribution.
13 }
14
15 { Modify the following two constants to your liking: }
16
17 cover_frac : 0.65; { average cloud cover (non-clear fraction) }
18
19 cloud_refl : 0.7; { average cloud reflectance (always white) }
20
21 { Leave the rest alone. }
22
23 PI : 3.14159265358979323846;
24
25 clouds(u,v,s) = if(s-.5, noise2(sin(2*PI/xmax*x)+13.5,sin(2*PI/ymax*y)-10.3),
26 noise2(u/s,v/s)*s + clouds(u,v,2*s));
27
28 minres : if(xmax-ymax, ymax, xmax);
29
30 clamp(x) : if(x, if(x-1, 1, x), 0);
31
32 coef = clamp( 1 +
33 (.5/sqrt(cover_frac)) * (clouds(x/minres, y/minres, 10/minres) - 1)
34 ) ;
35
36 cv = coef * cloud_refl;
37 pv = 1 - coef;
38
39 ro = cv + pv*ri(1);
40 go = cv + pv*gi(1);
41 bo = cv + pv*bi(1);