/************************************************************************** * TLSmoke.sl -- This is really Larry's noisysmoke.sl. I only took out the * random() as it made my animation look to funky -- tal 9/4/96 * * Description: * This is a volume shader for smoke. Trapezoidal integration is * used to integrate the GADD to find scattering and extinction. * * Parameters: * density - overall smoke density control * integstart, integend - bounds along the viewing ray direction of the * integration of atmospheric effects. * stepsize - step size for integration * use_lighting - if nonzero, light visibility along the ray will be taken * into account. * use_noise - makes the smoke noisy (nonuniform) when nonzero * freq, octaves, smokevary - control the fBm of the noisy smoke * lightscale - multiplier for light scattered toward viewer in volume * debug - if nonzero, copious output will be sent to stderr. * * Author: Larry Gritz * * History: * 9/4/96 tal -- took out random call and renamed to TLSmoke * * $Revision: 1.1.1.1 $ $Date: 2002/02/10 02:36:00 $ * * $Log: TLSmoke.sl,v $ * Revision 1.1.1.1 2002/02/10 02:36:00 tal * RenderMan Repository * * Revision 1.3 1996-03-01 17:07:40-08 lg * Eliminated duplicate local variable declarations * * Revision 1.2 1996-02-29 18:04:26-08 lg * Compute only one octave of noise when not lit (big speedup) * * Revision 1.1 1996-02-05 11:03:45-08 lg * Initial RCS revision * **************************************************************************/ #define snoise(p) (2*noise(p)-1) /* Here is where we define the GADD. */ #define GADD(PP,PW,li,g) \ if (use_lighting > 0) { \ li = 0; \ illuminance (PW, point(0,0,1), PI) { li += Cl; } \ } else { li = 1; } \ if (use_noise != 0) { \ Psmoke = PP*freq; \ smoke = snoise (Psmoke); \ /* Optimize: one octave only if not lit */ \ if (comp(li,0)+comp(li,1)+comp(li,2) > 0.01) { \ f=1; \ for (i=1; i 0) { printf ("nsteps = %f, t1 = %f, end = %f\n", nsteps, integstart, end); printf (" Cv = %c, Ov = %c\n", Cv, Ov); } }