In some cases, we'll need to use three-dimensional computer graphics for data visualization. To understand how three-dimensional computer graphics works, you have to understand how light leaves a light source, reflects off of an object, and then reaches your eye, so it can be perceived. So now we'll discuss three-dimensional graphics for visualization. So what will we learn? We'll learn about the real-world ways that light leaves a light source, and reaches our eye. We'll learn the physics of why is the sky blue, why is the sun yellow, why is grass green? And in general, how does three-dimensional graphic simulate these physical processes? And so here is a typical scene of the real world, and how we would perceive that? We have a light source, an object reflecting light, and a sensor, which is our eye. And light leaves, in this case, the sun and it's the slightest powerful across the spectrum, and so it's essentially white. But then that light goes to the sky, and the sky scatters the light differently based on which region of the spectrum it's dealing with. So light at the red wavelengths will get scattered less, and light at the blue wavelengths will get scattered more, so that light gets scattered to other locations in the sky, which makes the sky blue. And which makes the sun appear yellow, because that light's hitting all the way through. That yellow sunlight hits a tree, or grass, or any other biome. And certain wavelengths of that light are getting absorbed by chlorophyll molecules, and turned into hotosynthate, which feeds the tree. And so the chlorophyll is absorbing light, mostly in the blue regions, in the blue wavelengths, and in the red wavelengths, and reflecting light, not absorbing the light, in the green wavelengths. So the light reflected off of a tree is mostly green. And so then, it hits it in the eye, reaches our sensor in our eye, so that we can perceive it. And there it gets sensed by, essentially, cones, the colors, the wavelengths of light, stimulate three different kinds of cones, a mostly red cone, a mostly green cone, and a mostly blue cone. And these send three different responses to our perceptual system. And so you may have a complex wavelength of light indicating its color. But at some point, when the eye perceives that, that gets turned into three numbers instead of a bunch of numbers, and so we get this tristimulus theory of light perception. And that's why we display things using red, green, blue colors in pixels on graphics displays to directly stimulate the red cones, the green cones, and the blue cones. So we can simulate this process, and we can look, for example, at a camera. And a modern camera, in this case, a pin-hole camera that has a very small aperture, is getting light reflected off of an object, in this case, this blue bunny rabbit, that goes through a focal point. And it gets projected onto an image plane that would be sensed then in modern cameras by a CCD array. We can take that image plane, and we can just bring that in front of the camera, and we get the exact same image that's not inverted. It's just placed in front. And you can think of this as being a window, and you're looking through a window out into the world, and seeing a blue bunny. You could imagine where that blue bunny would be on the window that you see there. And that's the exact same image inverted that you would get on the film plane, because of the geometry of this camera system. Well, we can remove the camera system, and we can put an eye right at that focal point, and this gives us this image plane. And so basically when we're looking out into a three-dimensional scene, what we're seeing is the same thing that would be projected onto a two-dimensional window to the world through those some projectors just a certain fixed distance away. And that's the way we can simulate with a two-dimensional image what the eye would see in a three-dimensional world. And in computer graphics, as we discussed before with two-dimensional graphics, we're going to simulate shapes using primitives, in this case, vector primitives. Except these are now three-dimensional vector primitives, and so we have triangles. And the triangles are specified by three vertices. And those three vertices have edges between them and a region, we'll call a polygonal face. And you can create a mesh of these triangles to define a three-dimensional object, in this case, a bunny rabbit. And those triangles are then projected by what's called a three-dimensional graphics pipeline onto a two-dimensional image plane. And then the polygons on that two-dimensional image plane are then discretized into pixels. This is a rasterization process and, in fact, the same rasterization process we were discussing in two-dimensional graphics, where regions and edges are discretized into pixels, instead of straight lines and continuous regions. And so the way 3D graphics works is for each one of these triangles, each one of these primitives, we're going to figure out its illumination by simulating the light coming from a light source reflecting off of it. And then we're going to project that triangle and its lumination onto this image plane. And then we're going to rasterize that triangle by filling its region in with pixels. And that's what gets displayed on the pixel display. And so we can speak of these processes as vertex processing. This is also called transform and lighting, where we're taking vertices of triangles, and projecting them on to an image plane. Rasterization, taking those two-dimensional triangles, and converting them into pixels. And then pixel processing which takes those pixel regions, and figures out what color should be on their interior. We also will need to view three-dimensional scenes. We need to figure out where is the eye in the scene. And so we'll set up things like world coordinate systems. And this eye and this teapot example will be located at positions in three-dimensional coordinates in the same way that primitives were located in two-dimensional coordinates in the previous example. So we use this world coordinate system, and its origin is off some place, and we can describe everything relative to this coordinate system. And we will specify a view, basically, where are we and what are we looking at? Our eye point will be located at a certain set of coordinates in world coordinates. And will be looking at a point also specified as a set of coordinates in world coordinates, three coordinates, x, y, z. And then that view is going to be transformed into a new coordinate system that looks very similar to our canvas coordinate system, so that we have an x axis and a y axis. And, in this case, we're extending from (-1,-1) to (1,1). And these coordinates are the coordinates of the window we were looking through that forms the image plane. And another thing we want to do is to create a sense of perspective, so that things farther away appear smaller, and things closer to us appear larger. In computer graphics, we do that by processing the primitives themselves. We actually make the things that are farther away smaller, and the things that are closer to us larger. So this may look correct for a perspective scene of a teapot on a table, but if I look at it from the side view, what I've actually done is made the front of the table larger, and the back of the table is smaller. So that when it gets projected onto my 2-D image plane, I get correct proportions for a perspective rendering. And from this point, we've processed our primitives, and we would then rasterize them and fill them in, in the same fashions that we did for two-dimensional graphics examples. So we learned that three-dimensional graphics displays objects that are made out of triangle meshes. And that these triangle meshes are projected onto an image plane. And we specify how that projection happens with a view. We specify that view with an eye point, a viewing direction, and in an up direction. And then we use perspective to do that projection, so that things closer to us appear larger than things farther away. Also, the way the computer processes three-dimensional computer graphics is with a pipeline consisting of vertex processing, then rasterization, and then pixel processing. [MUSIC] [SOUND]