Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Standard view
Full view
of .
0 of .
Results for:
P. 1
Introduction to 3D Graphic

# Introduction to 3D Graphic

Ratings: (0)|Views: 128|Likes:

### Availability:

See more
See less

05/02/2011

pdf

text

original

Than Lwin Aung Introduction to 3D Graphic1
Introduction 3D Graphic
Nowadays, 3D graphics is everywhere ranging from computer simulation through computer games to 3Dimaging. In fact, rendering 3D objects onto 2D screen, such monitors, projectors etc. requires differentprocesses: Geometric Representation and Processing, Shading and Rasterization. Here I am notfollowing a specific graphics pipe-line, such as Direct3D or OpenGL. I am just describing the generalgraphics processing from a developer perspective. (For your information, I attach both graphics pipe-lines at the end.)
Geometrical Representation and Processing
It is primarily concerned with drawing geometric surfaces and 3D objects. Every 3D objects are madeup of surfaces. For example, the following cube is made up of 6 surfaces.The question is how we define a surface in 3D co-ordinate system. Geometrically, a triangle is thesimplest form of surface. By combining triangle surfaces, we can build every form of surfaces. Forexample:Simply enough, a triangle is made up of 3 points. The follow figure shows how each point is defined in3D coordinates.

Than Lwin Aung Introduction to 3D Graphic2We define the points of the triangle as vertices. In fact, a vertex stores more information than theposition of the point. In addition to the position of the point, it also stores color, normal vector at thepoint, and texture information. Therefore a vertex stores: position, color, normal and texture. Positioncan be represented with 3D vector <x,y,z>; color can be represented with RGBA (Red, Green, Blue andAlpha) ; normal can also be represented with 3D vector <x,y,z>; texture can be represent of 2D vector<x,y>.The question here is why we only need to define the color information only at the vertices of thetriangle. How about the points inside the triangle? Well, we interpolate the color and textureinformation for the points between vertices. For example, in the follow triangle, we only define thecolors at 3 vertices and the color is interpolated between 3 vertices.Therefore, it is pretty straightforward to understand the color information of the vertices. Next is thenormal information. The normal vector, in fact, represents the perpendicular vector of the trianglesurface. Since 3 vertices form a triangle surface, we can calculate the normal vector by performing cross-product between 2 positions vectors. For example:Normal = Vertex1 <x1,y1,z1>
X
Vertex2 <x2,y2,z2>Why do we need normal vector for the surface? Well, the answer is for a lot of things although theprimary purpose is to calculate light reflection, refraction and shading. We also need normal vector forcalculating the orientation of the surface.The last information each vertex store is the texture information. What is texture by the way? A texturein fact is nothing more an image. We use texture mapping to paste the image on the 3D surface. In fact,texture mapping saves us a lot of work for 3D modeling. How do we do texture mapping? It is in factsimple. Before going to the texture mapping, let me ask you a question. Are you familiar with the worldmap and the globe? The world map is 2D and the globe is 3D, right? How come? We in fact project the2D surface onto the 3D surface and vice versa. This is called texture mapping. Mathematically,<x,y,z> = R(<u,v>) , where R is a linear function which transform 2D (u,v) to 3D (x,y,z). There are variousfunctions of texture transformation depending on the surfaces.

Than Lwin Aung Introduction to 3D Graphic3Once we understand the vertices and their position, color, normal and texture, we can draw 3D objectsby creating different vertices and connect them together. In fact, there are a lot of 3D modeling toolsavailable to assist you to draw different 3D objects.Now suppose we have a 3D object called my cube, which looks like:What are we going to do with it? Well, we have to put it in the 3D world. 3D world is in fact the worldwhich has the absolute frame of reference (rather space but I feel space is too abstract for me) fordifferent 3D models. From now on, I will use the term model to describe a 3D object. In fact, the Worldprovides a frame of reference for different 3D models. Here each 3D model has their own frame of reference; in fact, they can rotate, spin, and shrink in its own frame of reference. In the following figure,my cube is put in the World Space along with another cube. But my cube is rotated in its own space.We now have 2 spaces: Model Space and the World Space. In fact, the World Space not only providesthe space for the 3D models to be put, but also for other things, such as the Camera (Eye) and the LightSource. Why do we need the Camera and the Light Source? Well, without them, how will we see ourbeautiful 3D objects?