Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.

Slides:



Advertisements
Similar presentations
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Building Models modified by Ray Wisman Ed Angel Professor of Computer Science,
Advertisements

1 Building Models. 2 Objectives Introduce simple data structures for building polygonal models ­Vertex lists ­Edge lists OpenGL vertex arrays.
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Lab 1: OpenGL Tutorial CS 282. What’s the plan for today? Go over our framework code. Learn some basic OpenGL! Reveal Lab 1 Answer questions.
Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
IAT 3551 Computer Graphics Overview Color Displays Drawing Pipeline.
Alyce Brady CS 510: Computer Algorithms Depth-First Graph Traversal Algorithm.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2008 Tamara Munzner Transformations III Week.
Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
3D Rendering with JOGL Introduction to Java OpenGL Graphic Library By Ricardo Veguilla
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
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
COMP 175: Computer Graphics March 10, 2015
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 1/29 Geometric Transformations Readings: Chapters 5-6.
COS 397 Computer Graphics Assoc. Prof. Svetla Boytcheva AUBG 2013 COS 397 Computer Graphics Practical Session №1 Introduction to OpenGL, GLFW and CG.
Chapter 10 Bresenham’s Algorithm Data Structures and Graphics or Working with Models.
Graphical Objects and Scene Graphs 1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009.
3D Objects Subject:T0934 / Multimedia Programming Foundation Session:12 Tahun:2009 Versi:1/0.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Demetriou/Loizidou – ACSC330 – Chapter 9 Hierarchical and Object-Oriented Modeling Dr. Giorgos A. Demetriou Dr. Stephania Loizidou Himona Computer Science.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
Implementing Scene Graphs, CSG Trees Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, January 26, 2004.
Ch 2 Graphics Programming page 1 CSC 367 Coordinate Systems (2.1.2) Device coordinates, or screen coordinates (pixels) put limitations on programmers and.
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.
CS559: Computer Graphics Lecture 15: Hierarchical Modeling and Shading Li Zhang Spring 2008.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
Transformations Tutorial
Computer Graphics I, Fall 2008 Hierarchical Modeling II.
Scene Graph & Game Engines. 2 Limitations of Immediate Mode Graphics  When we define a geometric object in an application, upon execution of the code.
OpenGL: The Open Graphics Language Introduction By Ricardo Veguilla.
Models & Hierarchies CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Hierarchical Modeling.
Attack of the Clones Image source:
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.
1 Perception, Illusion and VR HNRS 299, Spring 2008 Lecture 15 Creating 3D Models.
Computer Graphics I, Fall 2010 Building Models.
CS559: Computer Graphics Lecture 13: Hierarchical Modeling and Curves Li Zhang Spring 2010.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
Hierarchical Models Chapter 9.
Computer Graphics Overview
Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Graphical Objects and Scene Graphs
Graphical Objects and Scene Graphs
Using the basic-objects-IFS.js Utility
Modeling and Hierarchy
Computer Graphics - Hierarchical Models-
Modeling and Hierarchy
Hierarchical and Object-Oriented Graphics
Introduction to Computer Graphics with WebGL
Building Models Ed Angel
CSCE 441: Computer Graphics: Hierarchical Models
Isaac Gang University of Mary Hardin-Baylor
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling I
Transformations III Week 3, Mon Jan 21
Transformations IV Week 3, Wed Jan 23
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
Hierarchical Modeling
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Jul 25, 2014IAT 3551 Scene Graphs

 A data structure that stores information about a graphics scene –Each node has information that structures the interpretation of child nodes Jul 25, 2014IAT 3552

Computer Graphics  We have been using immediate mode graphics  When we define a geometric object: –Call its drawing code glPushMatrix() glBegin( GL_TRIANGLES ); glVertex3f( 1.0, 2.0, 3.0 );... glEnd(); glPopMatrix(); Jul 25, 2014IAT 3553

Immediate Mode  Graphics objects are not retained once they are drawn  To redraw the scene, must reexecute the code  Makes sense, because the screen needs redrawing when new info arrives Jul 25, 2014IAT 3554

OpenGL and Objects  OpenGL has a weak notion of objects  Eg. Consider a red cube –Model the cube with squares –Color is determined by OpenGL state (current color, current lighting)  Not really an object Jul 25, 2014IAT 3555

Imperative Programming Model  Example: rotate the cube –Application sends cube data to the graphics subsystem –The graphics subsystem maintains state Current rotation, translation... –The rotate function must know how the cube us represented Vertex list Edge list Jul 25, 2014IAT 3556

Object Oriented Graphics  In OO graphics, the representation is stored with the model  The application sends updates to the cube model, which stores state such as transformation, color  The object contains functions that allow it to transform itself Jul 25, 2014IAT 3557

Java  The obvious means to do this is to store objects in instances of classes –Methods do transformation and trigger drawing calls Jul 25, 2014IAT 3558

Cube object  Create an object that allows us to store rotation, translation, color... Cube myCube ; myCube.color[0] = 1.0 ; myCube.color[1] = 0.0 ;... myCube.matrix [0][0] = 1.0 ;.... Jul 25, 2014IAT 3559

Cube object functions  Also want common functions to act on the cube’s data: myCube.translate( tx, ty, tz ); myCube.rotate( r, 1.0, 0.0, 0.0 ); myCube.setColor( r, g, b);  Draw it! myCube.render(); Jul 25, 2014IAT 35510

class cube { public: float color [3] ; float matrix[4][4] ; private: //implementation } Jul 25, 2014IAT 35511

The Implementation  Can choose any old way of representing the cube –Vertex list, polygons...  Private stuff accesses the public piece  Render method makes OpenGL calls Jul 25, 2014IAT 35512

Other Objects  Other types of objects are: –3D Cameras –3D Lights  Also non-geometric things –Materials, colors –Matrices (storing geometric transformations) Jul 25, 2014IAT 35513

Application cube myCube ; materialplastic ; myCube.setMaterial( plastic ); camera frontView; frontView.position( x, y, z ); Jul 25, 2014IAT 35514

Scene Descriptions  If you can represent all scene elements as objects –Cameras –Lights –Material –Geometry  Put it all in a tree and traverse the tree –Render scene by traversal Jul 25, 2014IAT 35515

Scene Graph Jul 25, 2014IAT 35516

Scene Graph glPushAttrib glPushMatrix glColor glTranslate glRotate Object1 glTranslate Object2 glPopMatrix glPopAttrib... Jul 25, 2014IAT 35517

Scene Graph Traversal  Similar to preorder traversal of binary tree –Visit a node “Activate” the node -- pushMatrix/Attrib Vist all children in child order “UNActivate” node -- popMatrix/Attrib Jul 25, 2014IAT 35518

Separator nodes  Necessary to mark places where attribute changes take place –Where the OpenGL push/pop live  Advantage: –You can write a universal traversal algorithm –Traversal order must be predictable In OpenGL, state changes stick around Setting color sticks until the next color change Jul 25, 2014IAT 35519

Scene Graphs  There is a very important strategy: –Transform Code into a Data Structure  What was previously a bunch of OpenGL calls is now: –Graph nodes of various kinds –Each node type has well-defined rules Jul 25, 2014IAT 35520

Java3D  Java3D provides a Scene Graph API Jul 25, 2014IAT 35521

Scene Graph Hierarchy  Changes to Parent nodes affect all children –Translate of a sub-tree moves all of its nodes –Specify this large-scale change in one place –The scene graph rules handle the rest Jul 25, 2014IAT 35522