Category : Files from Magazines
Archive   : DDJ1188.ZIP
Filename : UPSTILL.ASC

 
Output of file : UPSTILL.ASC contained in archive : DDJ1188.ZIP
_PHOTOREALISM AND COMPUTER GRAPHICS_
by
Steve Upstill

[EXAMPLE 1]

surface
marble( float Kd=.5, Ka=.1;
color veincolor=0)
{
float khi ;
point fnormal ;
color surfcolor ;
point freq = 4 * P;
float turbulence = 0;
float amplitude = 1, octave;

/* Make sure the eye-vector points the right way */
fnormal = faceforward( normalize(N), I ) ;

/* Accumulate a 3-dimensional noise function over 6 octaves,
weighting each by 1/f. */
for(octave = 0; octave < 6; octave = octave + 1 ) {
turbulence = turbulence +
amplitude * abs(.5 - noise(freq));
amplitude = amplitude * .5;
freq = freq * 2;
}

turbulence = 0.5 + 0.5 * sin(6*(xcomp(P)+turbulence)) ;
/* sharpen peaks */
turbulence = turbulence * turbulence * turbulence;

/* map discontinuously to vein colors */
khi = clamp((turbulence-0.5)*4, 0, 1);

surfcolor = (1-khi)*Cs + khi*veincolor;
Ci = surfcolor*(Ka*ambient() + Kd*diffuse(N));
}



[EXAMPLE 2]

light
windowlight(
point from = point (3, 1, -1), /* Center of the window */
to = point (0,0,0);
float intensity=1,
order = 2, /* (# of panes up and down)/2 */
fuzz = .02, /* blurred region around panes */
framewid = .1, /* width of a pane frame member */
panewid = .5; /* width of the glass in a pane */
color lightcolor = color (1,.9,.6),
darkcolor = color (.05,.2,.1);
)
{
float halfframeplus, halfframeminus;
float windowwid;
point wfrom, wto;
point wL, wP;
float shade, yabs, zabs, ymod, zmod;

/* where pane-to-frame transition begins */
halfframeplus = framewid/2+fuzz;
halfframeminus = framewid/2-fuzz;
windowwid = framewid+panewid;

/* Move window center, sunlight vector back to world space */
wfrom = transform( "world", from );
wto = transform( "world", to );
wL = wto - wfrom;

wP = transform( "world", P );
/* Project surface position onto x=xcomp(wfrom) plane */
wL *= (xcomp(wfrom)-xcomp(wP))/xcomp(wL);
wP = wP + wL - wfrom;

/* absolute distance from window center */
yabs = abs(ycomp(wP));
zabs = abs(zcomp(wP));
if( max(yabs, zabs)>(windowwid*order)) { /* Outside window? */
shade = 0;
} else {
/* Modulus reduces insideness to a single pane */
ymod = mod(yabs,windowwid);
zmod = mod(zabs,windowwid);
shade =
smoothstep(halfframeminus, halfframeplus, ymod)*
smoothstep(halfframeminus, halfframeplus, windowwid-ymod)*
smoothstep(halfframeminus, halfframeplus, zmod)*
smoothstep(halfframeminus, halfframeplus, windowwid-zmod);
}

L = to - from; /* always the same (needed for surface shading) */
Cl = mix(darkcolor, lightcolor, shade);
}



[EXAMPLE 3]


displacement
threads ( float freq = 5.0,
amplitude = 0.1,
phase = 0.0,
offset = 0.0;)
{
point nDel;
float scale;

/* surface displacement occurs along nDel */
nDel = normalize(N);

/* The amount of displacement is given by a sinusoid along the
length of the cylinder, with the place around the cylinder
providing an additional phase factor for spiral threads */
scale = (sin( PI*2*(v*freq + u + phase))+offset) * amplitude;

if( v > 0.95) /* Damp the oscillation to 0 at the ends */
scale = scale * (1.0-v) / .05;
else if( v < 0.05 )
scale = scale * v / .05;

nDel = nDel * scale;
P = P + nDel;
N = calculatenormal(P);
}


[EXAMPLE 4]

surface
filament ( float freq = 5.0, phase = 0.0, width = 0.3;
color filcolor = color (1, .84, .76); )
{
float distance; /* Distance from the spiral */

distance = mod((t*freq + s + phase), 1.0);
if(distance < width) {
/* Inside the filament */
Ci = filcolor;
Oi = 1.0; /* Make it opaque */
} else {
Oi = 0.0; /* Make it transparent */
}
}






  3 Responses to “Category : Files from Magazines
Archive   : DDJ1188.ZIP
Filename : UPSTILL.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/