Lecture15-RayTracingBasics

# Cen ifd0nvcomb 1nblacketa1etad dlsph5whilel sphifel

• Notes
• 30

This preview shows page 12 - 13 out of 30 pages.

>cen )));if(d<0)N=vcomb(-1.,N,black),eta=1/eta,d= -d;l=sph+5;while(l-- >sph)if((e=l ->kl*vdot(N,U=vunit(vcomb(-1.,P,l- >cen))))>0&&intersect(P,U)==l)color=vcomb(e ,l->color,color);U=s->color;color.x*=U.x;color.y*=U.y;color.z*=U.z;e=1-eta* eta*(1-d*d);return vcomb(s->kt,e>0?trace(level,P,vcomb(eta,D,vcomb(eta*d- sqrt (e),N,black))):black,vcomb(s->ks,trace(level,P,vcomb(2*d,N,D)),vcomb(s->kd, color,vcomb(s->kl,U,black))));}main(){ puts(“P3\n32 32\n255”) ;while(yx<32*32) U.x=yx%32-32/2,U.z=32/2-yx+ +/32,U.y=32/2/tan(25/114.5915590261),U=vcomb(255., trace(3,black,vunit(U)),black),printf("%.0f %.0f %.0f\n",U);}/*minray!*/

Subscribe to view the full document.

Ray Tracing: Types of Rays Primary rays: § Sent from the eye, through the image plane, and into the scene § May or may not intersect an object in the scene: -

#### You've reached the end of your free preview.

Want to read all 30 pages?

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern