


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
Pradeep Sen Advanced Graphics Lab
Class 8 September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
float filteredstep (float edge, float x, float w) {
return clamp ((x + w/2 โ edge), 0, 1);
}
#define filterwidth(x)
max( abs(Du(x)du) + abs(Dv(x)dv), MINFILTWIDTH);
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
float oaktexture (point Pshad; float dPshad; float ringfreq, ringunevenness, grainfreq; float ringnoise, ringnoisefreq; float trunkwobble, trunkwobblefreq; float angularwobble, angularwobblefreq; float ringy, grainy;) { /* We shade based on Pshad, but we add several layers of warping: / / Some general warping of the domain / vector offset = vfBm(Pshadringnoisefreq, dPshadringnoisefreq, 2, 4, 0.5); point Pring = Pshad + ringnoiseoffset;
/* The trunk isn't totally steady xy as you go up in z / Pring += trunkwobble * vsnoise(zcomp(Pshad)trunkwobblefreq) * vector(1,1,0);
source: Apodaca and Gritz
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
/* Calculate the radius from the center. */ float r2 = sqr(xcomp(Pring)) + sqr(ycomp(Pring)); float r = sqrt(r2) * ringfreq;
/* Add some noise around the trunk / r += angularwobble * smoothstep(0,5,r) * snoise (angularwobblefreq(Pring)*vector(1,1,0.1));
/* Now add some noise so all rings are not equal width / extern float du, dv; float dr = filterwidth(r); r += ringunevennessfilteredsnoise(r,dr);
float inring = smoothpulsetrain (.1, .55, .7, .95, 1, r);
point Pgrain = Pshadgrainfreqvector(1,1,.05); float dPgrain = filterwidthp(Pgrain); float grain = 0; float i, amp=1; source: Apodaca and Gritz (^) ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
for (i = 0; i < 2; i += 1) { float grain1valid = 1-smoothstep(.2,.6,dPgrain); if (grain1valid > 0) { float g = grain1valid * snoise (Pgrain); g = (0.3 + 0.7inring); g = pow(clamp(0.8 - (g),0,1),2); g = grainy * smoothstep (0.5, 1, g); if (i == 0) inring = (1-0.4grain1valid);
grain = max (grain, g); }
Pgrain *= 2; dPgrain *= 2; amp = 0.5; } return mix (inringringy, 1, grain); } source: Apodaca and Gritz
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
surface oak ( float Ka = 1, Kd = 1, Ks = .25, roughness = 0.2;DEFAULT_PSHAD_PARAMS; float ringfreq = 8, ringunevenness = 0.5; float ringnoise = 0.02, ringnoisefreq = 1; float grainfreq = 25; float trunkwobble = 0.15, trunkwobblefreq = 0.025; float angularwobble = 1, angularwobblefreq = 1.5; float divotdepth = 0.05; color Clightwood = color (.5, .2, .067); /* light wood color */ color Cdarkwood = color(0.15, 0.077,0.028); float ringy = 1, grainy = 1; float truedisp = 0; ) { source: Apodaca and Gritz (^) ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
normal Nf = faceforward(normalize(N),I);
float wood; wood = oaktexture (Pshad, dPshad, ringfreq, ringunevenness, grainfreq, ringnoise, ringnoisefreq, trunkwobble, trunkwobblefreq, angularwobble, angularwobblefreq, ringy, grainy); color Cwood = mix (Clightwood, Cdarkwood, wood);
Nf = faceforward(Displace (Nf, "shader", -wooddivotdepth, truedisp), I); / Illumination model - just use plastic / Ci = MaterialPlastic (Nf, Cwood, Ka, Kd, Ks(1-0.5*wood), roughness); Oi = Os; Ci *= Oi; } source: Apodaca and Gritz
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
source: Apodaca and Gritz (^) ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
SelfSelf--emittedemitted radiosityradiosity
reflectivityreflectivity totaltotal radiosityradiosity
Form factor source: Dutrรฉ et al. (^) ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008
flat Gouraud (^) source: Dutrรฉ et al.
ECE/CS 512 Advanced Image Synthesis Pradeep Sen Class 8 โ September 22, 2008