150 likes | 301 Views
Overview: Ray Tracing. 22C:151 Computer Graphics Fall 2010. Preliminaries. Q: What is computer graphics? (Remember first class, or think of new ideas). Preliminaries. Q: What is computer graphics? Lots of subpieces , e.g.: Modeling Data representations Properties of virtual objects
E N D
Overview: Ray Tracing 22C:151 Computer Graphics Fall 2010
Preliminaries • Q: What is computer graphics? • (Remember first class, or think of new ideas)
Preliminaries • Q: What is computer graphics? • Lots of subpieces, e.g.: • Modeling • Data representations • Properties of virtual objects • Today, key ideais graphics involves image creation
Preliminaries • Q: What is an image?
Preliminaries • Q: What is an image? • In general, computer graphics output may include physical products, simulation data, video, sound, et cetera. • For this class, we will use a more common definition: A regular array of discrete pixels Also known as a raster image
Preliminaries • Raster Image: • A grid of pixels • Each pixels stores a color • Usually consisting of red, green, and blue components • Most of graphics is concerned with how to create images
How to Create an Image? • Two main approaches: • Rasterization • Ray tracing
How to Create an Image? • Two main approaches: • Rasterization • Ray tracing • For context: • Rasterization is used in most modern video games • Ray tracing is used in many physical simulations • Movies typically use “REYES,” a variant of rasterization, though recent films are beginning to rely on ray tracing
What is the Difference? • When coding, they appear very different • But similar at a high level • Rasterization: • For each piece of geometry • For each pixel inside the geometry • Color the pixel based on surface properties • Ray tracing: • For each pixel on screen • Find the closest visible piece of geometry • Color the pixel based on surface properties
What is the Difference? • When coding, they appear very different • But similar at a high level • Rasterization: • For each piece of geometry • For each pixel inside the geometry • Color the pixel based on surface properties • Ray tracing: • For each pixel on screen • Find the closest visible piece of geometry • Color the pixel based on surface properties Changes: Order of the loops!
Basic Ray Tracing • Given the basic ray tracing algorithm: • For each pixel on screen • Find the closest visible piece of geometry • Color the pixel based on surface properties • Q: What do you need to learn in order to implement it? • Discuss with your neighbors
Basic Ray Tracing • Q: What do you need to learn in order to implement it? • Discuss with your neighbors
Basic Ray Tracing • Did this last Thursday: • For each pixel on screen • Fill with a random color • So clearly, looping over pixels is not so hard
Basic Ray Tracing • For each pixel: • Compute a ray through the pixel • Intersect ray with all geometry • Shade at closest intersection (smallest d) distance d
But First: Review Some Math • Time to dust off your linear algebra!