Chapter 4 Chapter 4 Chapter 4. Introduction to 3D graphics 4.1 Scene traversal 4.2 Modeling transformation 4.3 Viewing transformation 4.4 Clipping 4.5 Hidden faces removal 4.6 Projection 4.7 Lighting 4.8 Other operations Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 1
The visualization process Image synthesis process (visualization process) is the set of 3D and 2D operations undertaken over a computer data model that generate a graphic representation of the model in a physical display Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 2
The visualization process In general, the following is considered as available: A 3D geometric description of the objects A physic description of the objects (physics properties) A scene observer or viewer Lighting (a collection of lights) A visualization device An objective to accomplish (realism, performance, color coding, etc.) Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 3
The visualization process Scene traversal Modeling transformation Viewing transformation Clipping Hidden faces removal Projection Device transformation Lighting Rasterization Screen Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 4
4.1 Scene traversal The scene is the set of the objects we want to visualize and their environment (lights, viewer, etc.) The object geometry is described with a model Scene traversal means querying methods about the characteristics of the object to visualize. Coordinate system: particular 3D system of the objects Techniques involved Geometric surface modeling Solid modeling Other models (scientific data, fractals, grammars, etc.) Hierarchical modeling Traversing algorithms and data structure querying Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 5
4.2 Modeling transformation It is common to have to put the objects on the final scene from particular coordinate systems on which they were originally defined. Modeling transformation implies a change in the coordinate system: Model coordinates Scene coordinates Techniques involved: Afin space (vectors and points) Afin transformations (translation, rotation and scaling) Transformation matrices Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 6
4.3 Viewing transformation Visualization means the existence of a viewer. Viewing transformation, once the viewer position is known, implies a change from the scene coordinate system to a local coordinate system of the viewer. The local coordinate system of the viewer is defined by the viewing transformation. Scenes coordinates Viewing coordinates Techniques involved: Viewing modeling (synthetic camera, viewing volume, etc) Afin transformations Transformation matrices Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 7
4.4 Clipping The viewer s vision field is determined by the viewing volume. Everything outside the vision field has to be removed before future operations: clipping process. In general, clipping process involves the calculation of overlapped parts between to geometric entities. In this case, on of the geometric entities is the viewing modeling; the other is each of the objects to visualize. Techniques involved: Calculation of intersections Inner criterion Concavity and convexity Line clipping algorithms Polygon clipping algorithms Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 8
4.5 Hidden faces removal In a scene, objects are self-covered are covered among them, letting always hidden parts to the user. The hidden parts (faces) have to be removed from later operations: visibility process. The visibility process is complex, so many solutions are available. A simple classification: Problem solution at scene coordinate system (object space) Problem solution through the device (image space) Techniques involved: Normal vector calculation Sorting Visibility algorithms Acceleration through coherence Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 9
4.6 Projection The device representation is 2D, but scene is in 3D. The operation that allows the transition from a 3D to a 2D system is known as projection. The projection of a 3D point over a plane is determined by tracing a line (also called a visual) through the point and calculating its intersection over the plane. Projection types: Parallel: parallel visuals Perspective: visuals start at viewer s position (point of view) Techniques involved: Projecting systems Projecting matrices Perspective-to-parallel projection Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 10
4.7 Lighting Knowing the points to be lighted, it is necessary to know the color that has to be assigned to everyone. Color depends on: Lighting conditions of the 3D point over the object surface The shape (normal vector) of the object is that point. Optical properties of the object material The surface finishing (roughness). The color of the object (of its material or painting). A lighting model takes into account all previous factors in order to calculate the color which is seen at that point. Techniques involved: Shadowing and lighting models, textures,... Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 11
4.8 Other operations Interactivity Answer to user s actions over the screen. An interaction means: The user s action: event Event understanding: message Communication with the application: callback function Graphics update Model building The model is built: From a real image (acquiring) From an idea (editor) Using libraries and tools All described operations are coded using graphic libraries (OpenGL, StarBase, etc.) User s event Graphics Application New graphics Computer Graphics 2006/2007 Chapter 4. Introduction to 3D 12