CSC461: Lecture 26 Advanced Topics on Computer Graphics

CSC461: Lecture 26 Advanced Topics on Computer Graphics

CSC461: Lecture 26 Advanced Topics on Computer Graphics Objectives Review some advanced topics, including Chapter 8: Implementation Chapter 9: Hierarchical Modeling Implementation -- Meta Algorithms Consider two approaches to rendering a scene with opaque objects For every pixel, determine which object that projects on the pixel is closest to the viewer and compute the shade of this pixel Ray tracing paradigm For every object, determine which pixels it covers and shade these pixels

Pipeline approach Must keep track of depths Implementation -- Common Tasks Clipping Rasterization or scan conversion Antialiasing Transformations Hidden surface removal Implementation Line Clipping 2D against clipping window 3D against clipping volume Easy for line segments polygons Hard for curves and text Convert to lines and polygons first

Brute force approach: compute intersections with all sides of clipping window Inefficient: one division per intersection Cohen-Sutherland Algorithm Idea: eliminate as many cases as possible without computing intersections Start with four lines that determine the sides of the clipping window Implementation Polygon Clipping Not as simple as line segment clipping

Clipping a line segment yields at most one line segment Clipping a polygon can yield multiple polygons However, clipping a convex polygon can yield at most one other polygon Clipping as a Black Box Can consider line segment clipping as a process that takes in two vertices and produces either no vertices or the vertices of a clipped line segment Implementation Pipeline Clipping Line Segments Clipping against each side of window is independent of other sides Can use four independent clippers in a pipeline Polygons

Three dimensions: add front and back clippers Strategy used in SGI Geometry Engine Small increase in latency Hierarchical Modeling Start with a prototype object (a symbol) Each appearance of the object in the model is an instance Must scale, orient, position Defines instance transformation Symbol-Instance Table: Can store a model by assigning a number to each symbol and storing the parameters for the instance transformation Car Modeling Symbol-instance table does not show relationships between parts of model Consider model of car

Chassis + 4 identical wheels Two symbols Rate of forward motion determined by rotational speed of wheels Hierarchical Models Graph Models Set of nodes and edges (links) Edge connects a pair of nodes Directed or undirected Cycle: directed path that is a loop Tree Models Graph in which each node (except the root) has exactly one parent node May have multiple children Leaf or terminal node: no

children A Tree Model for Car loop root node leaf node Hierarchical Models -- Robot Arm robot arm Robot arm is an example of an articulated model parts in their own coodinate systems Parts connected at joints Can specify state of model by giving all joint angles Relationships in Robot Arm

Base rotates independently Lower arm attached to base Single angle determines position Its position depends on rotation of base Must also translate relative to base and rotate about connecting joint Upper arm attached to lower arm Its position depends on both base and lower arm Must translate relative to lower arm and rotate about joint connecting to lower arm Hierarchical Models -- Robot Arm Required Matrices Rotation of base: Rb

Translate lower arm relative to base: Tlu Rotate lower arm around joint: Rlu Apply M = Rb Tlu Rlu to lower arm Translate upper arm relative to upper arm: Tuu Rotate upper arm around joint: Ruu Apply M = Rb to base Apply M = Rb Tlu Rlu Tuu Ruu to upper arm Tree Model of Robot Note code shows relationships between parts of model

Can change look of parts easily without altering relationships Simple example of tree model Want a general node structure for nodes OpenGL Code for Robot Arm robot_arm() { glRotate(theta,0.0,1.0,0.0); base(); glTranslate(0.0, h1, 0.0); glRotate(phi, 0.0, 1.0, 0.0); lower_arm(); glTranslate(0.0, h2, 0.0); glRotate(psi, 0.0, 1.0, 0.0); upper_arm(); } Limitations of Immediate Mode Graphics and Objects

When we define a geometric object in an application, upon execution of the code the object is passed through the pipeline It then disappears from the graphical system To redraw the object, either changed or the same, we must reexecute the code Display lists provide only a partial solution to this problem OpenGL lacks an object orientation Consider, for example, a green sphere We can model the sphere with polygons or use OpenGL quadrics Its color is determined by the OpenGL state and is not a property of the object Defies our notion of a physical object We can try to build better objects in code using object-oriented languages/techniques Objects and Implementation Imperative Programming Model rotate a cube

The rotation function must know how the cube is represented: Vertex list or Edge list cube data Application glRotate Object-Oriented Programming Model The application sends a message to the object The object contains functions (methods) which allow it to transform itself Application results message Cube Object Cube Object : Suppose that we want to create a simple cube object that we can scale, orient, position and set its color directly through code such as cube mycube; mycube.color[0]=1.0; mycube.color[1]=mycube.color[2]=0.0; mycube.matrix[0][0]=

mycube.translate(1.0, 0.0,0.0); mycube.rotate(theta, 1.0, 0.0, 0.0); Scene Graphs Scene Descriptions If we recall figure model, we saw that If we can represent all the elements of a scene (cameras, lights,materials, geometry) as C++ objects, we should be able to show them in a tree We could describe model either by tree or by equivalent code We could write a generic traversal to display Render scene by traversing this tree Scene Graph

Recently Viewed Presentations

  • Write 4 sentences to describe this photo. 2 with SER and 2 ...

    Write 4 sentences to describe this photo. 2 with SER and 2 ...

    Write 4 sentences to describe this photo. 2 with SER and 2 with ESTAR. Tarea: Check answers below. The teachers are chatting. Los maestros/profesoresestáncharlando. The travelers are eating. ... Las chicas son amables.
  • Inserting and Formatting Graphics (continued)

    Inserting and Formatting Graphics (continued)

    Creating SmartArt Graphics. SmartArt . graphics are built-in, predesigned, and formatted layouts that you can use to illustrate concepts and ideas. The graphics are organized in a gallery under eight different categories,and each category includes several layouts.
  • Essential Question: Where are the major physical features and ...

    Essential Question: Where are the major physical features and ...

    Create a Mnemonic Device to help remember the countries of Latin America. Have students work individually or with a partner to create a mnemonic device to remember the countries of Latin America. Students can write their mnemonic device on the...
  • Today's Overview - Texas Tech University

    Today's Overview - Texas Tech University

    What artifacts are forthcoming from the first phase? What artifacts are forthcoming from the second phase? What is the relationship between the WBS and the network diagram? What is the default relationship between tasks in sequence? What is the home...
  • The High Energy Frontier Past Present Future R.-D.

    The High Energy Frontier Past Present Future R.-D.

    The High Energy Frontier Past Present Future R.-D. Heuer, CERN Joint EPS-ECFA meeting, July 18, 2009
  • The Age of Railroads - Pequannock Township High School

    The Age of Railroads - Pequannock Township High School

    Rapid Growth of Railroads. ... The Interstate Commerce Act, 1877. In 1886, the Supreme Court ruled that a state could not set rates on interstate commerce! In response to public outcry, Congress passed the Interstate Commerce Act in 1877.
  • Closing the Loop: Using Feedback in EPICS Mark Rivers, Center ...

    Closing the Loop: Using Feedback in EPICS Mark Rivers, Center ...

    A distributed architecture that supports a wide range of solutions from small test stands to large integrated facilities. A set of tools that reduces software application and maintenance costs by providing: Configuration tools in place of programming A large installed...
  • Present Simple Tense

    Present Simple Tense

    Past Simple Tense . Zad. 69, 70 i 71, str. 96-97 - ONLY FIRST FIVE SENTENCES. 70. zadatak. They didn't collect postcards. You didn't jump high. Albert didn't play squash. The teacher didn't test our English. Fiona didn't visit her...