Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:

Slides:



Advertisements
Similar presentations
Computer Graphics - Rasterization -
Advertisements

CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Graphics Pipeline.
Chapter 6: Vertices to Fragments Part 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley Mohan Sridharan Based on Slides.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Hierarchical Modeling I Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Clipping.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Implementation I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
Hierarchical Transformations and Models CSE 3541 Matt Boggus.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
Hierarchical Transformations Hierarchical Models Scene Graphs
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
Objectives Introduce basic implementation strategies Clipping Scan conversion.
Demetriou/Loizidou – ACSC330 – Chapter 9 Hierarchical and Object-Oriented Modeling Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 14 Going-through.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
Week 4 Lecture 1: Hierarchical Modeling Part 1 Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E ©
Hierarchical Modeling. Instance Transformation Start with a prototype object (a symbol) Each appearance of the object in the model is an instance – Must.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 40 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 40 Computer Graphics Hierarchy I.
Kinematics Jehee Lee Seoul National University. Kinematics How to animate skeletons (articulated figures) Kinematics is the study of motion without regard.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
1Computer Graphics Implementation II Lecture 16 John Shearer Culture Lab – space 2
Implementation II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Implementation II.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Scene Graph & Game Engines. 2 Limitations of Immediate Mode Graphics  When we define a geometric object in an application, upon execution of the code.
CAP 4703 Computer Graphic Methods Prof. Roy Levow Chapter 9.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Attack of the Clones Image source:
Computer Graphics I, Fall 2010 Implementation II.
Graphical Objects and Scene Graphs Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Hierarchical Modeling. 2 Objectives Build a tree-structured model of a humanoid figure. Examine various traversal strategies. Build a generalized tree-model.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
Computer Graphics I, Fall 2008 Hierarchical Modeling I.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Lecture 9 From Vertices to Fragments. Objectives Introduce basic implementation strategies Clipping Rasterization hidden-surface removal.
Hierarchical Models Chapter 9.
Computer Graphics Implementation II
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Computer Graphics Shading in OpenGL
Graphical Objects and Scene Graphs
Graphical Objects and Scene Graphs
Using the basic-objects-IFS.js Utility
Modeling and Hierarchy
Hierarchical Transformations Hierarchical Models Scene Graphs
Implementation I Ed Angel
Computer Graphics - Hierarchical Models-
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
CSCE 441: Computer Graphics: Hierarchical Models
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction to Computer Graphics with WebGL
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling I
Hierarchical Modeling & Constructive Solid Geometry
Introduction to Computer Graphics with WebGL
Implementation I Ed Angel Professor Emeritus of Computer Science
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
Implementation II Ed Angel Professor Emeritus of Computer Science
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9: Hierarchical Modeling Chapter 9: Hierarchical Modeling CSC461: Lecture 26 Advanced Topics on Computer Graphics

Implementation -- Meta Algorithms Consider two approaches to rendering a scene with opaque objects 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 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 Ray tracing paradigm For every object, determine which pixels it covers and shade these pixels For every object, determine which pixels it covers and shade these pixels Pipeline approach Pipeline approach Must keep track of depths Must keep track of depths

Implementation -- Common Tasks Clipping Clipping Rasterization or scan conversion Rasterization or scan conversion Antialiasing Antialiasing Transformations Transformations Hidden surface removal Hidden surface removal

Implementation – Line Clipping 2D against clipping window 2D against clipping window 3D against clipping volume 3D against clipping volume Easy for line segments polygons Easy for line segments polygons Hard for curves and text Hard for curves and text Convert to lines and polygons first Convert to lines and polygons first Brute force approach: compute intersections with all sides of clipping window Brute force approach: compute intersections with all sides of clipping window Inefficient: one division per intersection Inefficient: one division per intersection Cohen-Sutherland Algorithm Cohen-Sutherland Algorithm Idea: eliminate as many cases as possible without computing intersections Idea: eliminate as many cases as possible without computing intersections Start with four lines that determine the sides of the clipping window Start with four lines that determine the sides of the clipping window

Implementation – Polygon Clipping Not as simple as line segment clipping Not as simple as line segment clipping Clipping a line segment yields at most one line segment Clipping a line segment yields at most one line segment Clipping a polygon can yield multiple polygons Clipping a polygon can yield multiple polygons However, clipping a convex polygon can yield at most one other polygon However, clipping a convex polygon can yield at most one other polygon Clipping as a Black Box 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 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 Line Segments Clipping against each side of window is independent of other sides Clipping against each side of window is independent of other sides Can use four independent clippers in a pipeline Can use four independent clippers in a pipeline Polygons Polygons Three dimensions: add front and back clippers Three dimensions: add front and back clippers Strategy used in SGI Geometry Engine Strategy used in SGI Geometry Engine Small increase in latency Small increase in latency

Hierarchical Modeling Start with a prototype object (a symbol) Start with a prototype object (a symbol) Each appearance of the object in the model is an instance Each appearance of the object in the model is an instance Must scale, orient, position Must scale, orient, position Defines instance transformation 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 Symbol-Instance Table : Can store a model by assigning a number to each symbol and storing the parameters for the instance transformation Car Modeling Car Modeling Symbol-instance table does not show relationships between parts of model Symbol-instance table does not show relationships between parts of model Consider model of car Consider model of car Chassis + 4 identical wheels Chassis + 4 identical wheels Two symbols Two symbols Rate of forward motion determined by rotational speed of wheels Rate of forward motion determined by rotational speed of wheels

Hierarchical Models Graph Models Graph Models Set of nodes and edges (links) Set of nodes and edges (links) Edge connects a pair of nodes Edge connects a pair of nodes Directed or undirected Directed or undirected Cycle: directed path that is a loop Cycle: directed path that is a loop Tree Models Tree Models Graph in which each node (except the root) has exactly one parent node Graph in which each node (except the root) has exactly one parent node May have multiple children May have multiple children Leaf or terminal node: no children Leaf or terminal node: no children A Tree Model for Car A Tree Model for Car loop root node leaf node

Hierarchical Models -- Robot Arm Robot arm is an example of an articulated model Robot arm is an example of an articulated model Parts connected at joints Parts connected at joints Can specify state of model by giving all joint angles Can specify state of model by giving all joint angles Relationships in Robot Arm Relationships in Robot Arm Base rotates independently Base rotates independently Single angle determines position Single angle determines position Lower arm attached to base Lower arm attached to base Its position depends on rotation of base Its position depends on rotation of base Must also translate relative to base and rotate about connecting joint Must also translate relative to base and rotate about connecting joint Upper arm attached to lower arm Upper arm attached to lower arm Its position depends on both base and 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 Must translate relative to lower arm and rotate about joint connecting to lower arm robot arm parts in their own coodinate systems

Hierarchical Models -- Robot Arm Required Matrices Required Matrices Rotation of base: R b Rotation of base: R b Apply M = R b to base Apply M = R b to base Translate lower arm relative to base: T lu Translate lower arm relative to base: T lu Rotate lower arm around joint: R lu Rotate lower arm around joint: R lu Apply M = R b T lu R lu to lower arm Apply M = R b T lu R lu to lower arm Translate upper arm relative to upper arm: T uu Translate upper arm relative to upper arm: T uu Rotate upper arm around joint: R uu Rotate upper arm around joint: R uu Apply M = R b T lu R lu T uu R uu to upper arm Apply M = R b T lu R lu T uu R uu to upper arm Tree Model of Robot Tree Model of Robot Note code shows relationships between parts of model Note code shows relationships between parts of model Can change “look” of parts easily without altering relationships Can change “look” of parts easily without altering relationships Simple example of tree model Simple example of tree model Want a general node structure for nodes Want a general node structure for nodes OpenGL Code for Robot Arm robot_arm(){ glRotate(theta,0.0,1.0,0.0); glRotate(theta,0.0,1.0,0.0); base(); base(); glTranslate(0.0, h1, 0.0); glTranslate(0.0, h1, 0.0); glRotate(phi, 0.0, 1.0, 0.0); glRotate(phi, 0.0, 1.0, 0.0); lower_arm(); lower_arm(); glTranslate(0.0, h2, 0.0); glTranslate(0.0, h2, 0.0); glRotate(psi, 0.0, 1.0, 0.0); glRotate(psi, 0.0, 1.0, 0.0); upper_arm(); 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 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 It then disappears from the graphical system To redraw the object, either changed or the same, we must reexecute the code To redraw the object, either changed or the same, we must reexecute the code Display lists provide only a partial solution to this problem Display lists provide only a partial solution to this problem OpenGL lacks an object orientation OpenGL lacks an object orientation Consider, for example, a green sphere Consider, for example, a green sphere We can model the sphere with polygons or use OpenGL quadrics 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 Its color is determined by the OpenGL state and is not a property of the object Defies our notion of a physical object Defies our notion of a physical object We can try to build better objects in code using object-oriented languages/techniques We can try to build better objects in code using object-oriented languages/techniques

Objects and Implementation Imperative Programming Model – rotate a cube Imperative Programming Model – rotate a cube The rotation function must know how the cube is represented: Vertex list or Edge list The rotation function must know how the cube is represented: Vertex list or Edge list Object-Oriented Programming Model Object-Oriented Programming Model The application sends a message to the object The application sends a message to the object The object contains functions (methods) which allow it to transform itself The object contains functions (methods) which allow it to transform itself 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 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); Application glRotate cube data results ApplicationCube Object message

Scene Graphs Scene Descriptions Scene Descriptions If we recall figure model, we saw that If we recall figure model, we saw that We could describe model either by tree or by equivalent code We could describe model either by tree or by equivalent code We could write a generic traversal to display We could write a generic traversal to display 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 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 Render scene by traversing this tree Render scene by traversing this tree Scene Graph Scene Graph