ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/lib/carpet.cal
Revision: 1.2
Committed: Tue Mar 18 17:30:17 2003 UTC (22 years, 1 month ago) by greg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
State: FILE REMOVED
Log Message:
Decided to move ray/lib directory into non-CVS distribution

File Contents

# User Rev Content
1 greg 1.1 {
2     Carpet function.
3    
4     Scale pattern to tuft size.
5    
6     A1 - tuft red color
7     A2 - tuft green color
8     A3 - tuft blue color
9     A4 - degree of variation
10     }
11     { carpet tuft position }
12     { Varies from [(1-A4),1] based on Perlin 3D noise function, a random wave
13     function over 3D space, with scalar value everywhere between about -1 and 1.
14     Sense of this is 0 means bottom of tuft and 1 means top (carpet surface). }
15     carpt = 1 - A4*(.5+.5*noise3(Px,Py,Pz));
16     { exponent for carpet color }
17     { Takes [(1-A4),1] range and maps it to [1,(1+4*A4)] for # interreflections }
18     carpe = 1 + 4*(1-carpt);
19     { coefficient (with fuzzies) }
20     { Takes square of carpt as general shading coefficient (self-shadowing)
21     and multiplies by some fractal noise hovering around 1 with a base frequency
22     10 times the tuft frequency (fuzzies). The noneg() function guarantees
23     positive results for outlying values of the noise functions. }
24     coef = noneg( carpt*carpt * (1 + .25*A4*fnoise3(Px*10,Py*10,Pz*10)) );
25     { carpet color }
26     { Final color is shading coefficient times carpet color raised to the power
27     of the number of interreflections, which causes both darkening and
28     deepening of color in between tufts. }
29     carpr = coef * A1^carpe;
30     carpg = coef * A2^carpe;
31     carpb = coef * A3^carpe;