Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.

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

Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Graphics Pipeline.
Based on slides created by Edward Angel
Hierarchical Modeling II Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico.
Graphics Systems I-Chen Lin’s CG slides, Doug James’s CG slides Angel, Interactive Computer Graphics, Chap 1 Introduction to Graphics Pipeline.
Vertices and Fragments III Mohan Sridharan Based on slides created by Edward Angel 1 CS4395: Computer Graphics.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Models and Architectures Ed Angel Professor of Computer Science, Electrical and Computer.
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
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
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:
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.
Week 2 - Wednesday CS361.
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.
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.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
Week 4 Lecture 1: Hierarchical Modeling Part 1 Based on Interactive Computer Graphics (Angel) - Chapter 10 1 Angel: Interactive Computer Graphics 5E ©
CS559: Computer Graphics Lecture 15: Hierarchical Modeling and Shading Li Zhang Spring 2008.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1Computer Graphics Lecture 4 - Models and Architectures John Shearer Culture Lab – space 2
COMPUTER GRAPHICS CSCI 375. What do I need to know?  Familiarity with  Trigonometry  Analytic geometry  Linear algebra  Data structures  OOP.
More on Advanced Interfaces, Image Basics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, November 21, 2003.
Representation. Objectives Introduce concepts such as dimension and basis Introduce coordinate systems for representing vectors spaces and frames for.
Jul 25, 2014IAT 3551 Scene Graphs.  A data structure that stores information about a graphics scene –Each node has information that structures the interpretation.
Lighting Review & Example Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, November 17, 2003.
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?
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.
1 Angel: Interactive Computer Graphics5E © Addison- Wesley 2009 Image Formation Fundamental imaging notions Fundamental imaging notions Physical basis.
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.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Chapter 1 Graphics Systems and Models Models and Architectures.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
1 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012 Models and Architectures 靜宜大學 資訊工程系 蔡奇偉 副教授 2012.
CSCE 441: Computer Graphics: Hierarchical Models Jinxiang Chai.
Introduction to 3-D Viewing Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 27, 2003.
Hierarchical Models Chapter 9.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
ICG Syllabus 1. Introduction 2. Viewing in 3D and Graphics Programming
Introduction to Computer Graphics with WebGL
Graphical Objects and Scene Graphs
Graphical Objects and Scene Graphs
Using the basic-objects-IFS.js Utility
Modeling and Hierarchy
Models and Architectures
Models and Architectures
Computer Graphics - Hierarchical Models-
Models and Architectures
Introduction to Computer Graphics with WebGL
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
Angel: Interactive Computer Graphics5E © Addison-Wesley 2009
Hierarchical and Object-Oriented Graphics
Models and Architectures
Hierarchical Modeling I
Models and Architectures
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Graphical Objects and Scene Graphs CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel

Objectives Introduce graphical objects. Generalize the notion of objects to include lights, cameras, attributes. Introduce scene graphs. CS4395: Computer Graphics 2

Limitations of Immediate Mode Graphics When a geometric object is defined in an application, code execution pushes the object is through the pipeline. It then disappears from the graphical system! To redraw the object, with or without change, the code must be re-executed. Display lists provide only a partial solution to this problem. CS4395: Computer Graphics 3

OpenGL and Objects OpenGL lacks object orientation. Consider a green sphere: – Can model the sphere with polygons or quadrics. – Color is determined by OpenGL state and is not a property of the object. Defies notion of a physical object! Can build better objects using object-oriented languages/techniques. CS4395: Computer Graphics 4

Imperative Programming Model Example: rotate a cube. The rotation function must know how the cube is represented: – Vertex list. – Edge list. CS4395: Computer Graphics 5 Application glRotate cube data results

Object-Oriented Programming Model The representation is stored with the object. The application sends a message to the object. The object contains functions (methods) that allow it to transform itself. CS4395: Computer Graphics 6 ApplicationCube Object message

C or C++ Can use C “struct” to build objects. C++ provides better support: – Use class construct. – Can hide implementation using public, private, and protected members in a class. – Can also use friend designation to allow classes to access each other. CS4395: Computer Graphics 7

Cube Object Suppose that we want to create a simple cube object whose scale, orientation, position and color can be set directly through code: cube mycube; mycube.color[0]=1.0; mycube.color[1]= mycube.color[2]=0.0; mycube.matrix[0][0]=……… CS4395: Computer Graphics 8

Cube Object Functions We would like to have functions that act on the cube: – mycube.translate(1.0, 0.0,0.0); – mycube.rotate(theta, 1.0, 0.0, 0.0); – setcolor(mycube, 1.0, 0.0, 0.0); We also need a way of displaying the cube – mycube.render(); CS4395: Computer Graphics 9

Building the Cube Object class cube { public: float color[3]; float matrix[4][4]; // public methods private: // implementation } CS4395: Computer Graphics 10

The Implementation Can use any implementation in the private part such as a vertex list. The private part can be accessed with public members. The implementation of class methods can be done as required without making it visible. Render method is tricky but will invoke the standard OpenGL drawing functions such as glVertex. CS4395: Computer Graphics 11

Other Objects Other objects have geometric aspects: – Cameras. – Light sources. Should be able to have non-geometric objects: – Materials. – Colors. – Transformations (matrices). CS4395: Computer Graphics 12

Application Code cube mycube; material plastic; mycube.setMaterial(plastic); camera frontView; frontView.position(x,y, z); CS4395: Computer Graphics 13

Light Object class light { // match Phong model public: boolean type; //ortho or perspective boolean near; float position[3]; float orientation[3]; float specular[3]; float diffuse[3]; float ambient[3]; } CS4395: Computer Graphics 14

Scene Descriptions Recap of figure model: – Can describe model either by tree or by equivalent code. – Can write a generic traversal for display. If all the elements of a scene (cameras, lights, materials, geometry) are represented as C++ objects, should be able to show them in a tree: – Render scene by traversing this tree. CS4395: Computer Graphics 15

Scene Graph CS4395: Computer Graphics 16

Preorder Traversal glPushAttrib glPushMatrix glColor glTranslate glRotate Object1 glTranslate Object2 glPopMatrix glPopAttrib … CS4395: Computer Graphics 17

Group Nodes Necessary to isolate state changes: – Equivalent to OpenGL Push/Pop. As with the figure model: – Can write a universal traversal algorithm. – The order of traversal can matter : If we do not use the group node, state changes can persist. CS4395: Computer Graphics 18

Inventor and Java3D Inventor and Java3D provide a scene graph API. Scene graphs can also be described by a file (text or binary): – Implementation independent way of transporting scenes. – Supported by scene graph APIs. Primitives should match capabilities of graphics systems: – Most scene graph APIs are built on top of OpenGL or DirectX (for PCs). Section 10.8, 10.9: lots of examples CS4395: Computer Graphics 19

VRML Want a scene graph that can be used over the World Wide Web. Need links to other sites to support distributed data bases. Virtual Reality Markup Language: – Based on Inventor data base. – Implemented with OpenGL. CS4395: Computer Graphics 20

Open Scene Graph Summary Supports complex geometries by adding occlusion culling in first pass. Supports translucently through a second pass that sorts the geometry. First two passes yield a geometry list that is rendered by the pipeline in a third pass. CS4395: Computer Graphics 21