Scene Graphs In 3D Graphics programming the structure used is a scene graph which is special tree structure designed to store information about a scene.

Slides:



Advertisements
Similar presentations
Using GLU/GLUT Objects GLU/GLUT provides very simple object primitives glutWireCube glutWireCone gluCylinder glutWireTeapot.
Advertisements

Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
HCI 530 : Seminar (HCI) Damian Schofield.
Modelling. Outline  Modelling methods  Editing models – adding detail  Polygonal models  Representing curves  Patched surfaces.
X86 and 3D graphics. Quick Intro to 3D Graphics Glossary: –Vertex – point in 3D space –Triangle – 3 connected vertices –Object – list of triangles that.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
Further Programming for 3D applications CE Introduction to Further Programming for 3D application Bob Hobbs Faculty of Computing, Engineering and.
OpenGL (II). How to Draw a 3-D object on Screen?
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
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
Basic 3D Graphics Chapter 5. Bird’s Eye View  Basic 3D Graphics –Basic concepts of 3D graphics, rendering pipeline, Java 3D programming, scene graph,
Modeling and representation 1 – comparative review and polygon mesh models 2.1 Introduction 2.2 Polygonal representation of three-dimensional objects 2.3.
Hierarchy, Modeling, and Scene Graphs Angel: Chapter 10 OpenGL Programming and Reference Guides, other sources. ppt from Angel, AW, etc. CSCI 6360/4360.
Course Overview, Introduction to CG Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, September 5, 2003.
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.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
CS559: Computer Graphics Lecture 33: Shape Modeling Li Zhang Spring 2008.
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.
Week 2 - Wednesday CS361.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
Transforms Hierarchical Modeling Scene Graphs Using hierarchical modeling techniques in 3D software design Transforms Local basis Matrix math review Matrices.
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.
Data Structures for Scenes, The Basics of Scene Graphs Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Friday,
CSE 470: Computer Graphics. 10/15/ Defining a Vertex A 2D vertex: glVertex2f(GLfloat x, GLfloat y); 2D vertexfloating pointopenGL parameter type.
Homogeneous Form, Introduction to 3-D Graphics Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Monday, October 20,
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.
Image Synthesis Rabie A. Ramadan, PhD 1. 2 About my self Rabie A. Ramadan My website and publications
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Business and Computing Deanery 3D Modelling Tools Week 3 Transformations, cloning and arrays, modifiers.
Computing & Information Sciences Kansas State University Lecture 19 of 42CIS 636/736: (Introduction to) Computer Graphics Lecture 19 of 42 William H. Hsu.
The Rendering Pipeline CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
© TMC Computer School HC20203 VRML HIGHER DIPLOMA IN COMPUTING Chapter 2 – Basic VRML.
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?
Scene Graphs In 3D Graphics programming the structure used is a scene graph which is special tree structure designed to store information about a scene.
1/50 CS148: Introduction to Computer Graphics and Imaging Transforms CS148: Introduction to Computer Graphics and Imaging Transforms.
2 COEN Computer Graphics I Evening’s Goals n Discuss viewing and modeling transformations n Describe matrix stacks and their uses n Show basic geometric.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Subject Name: Computer Graphics Subject Code: Textbook: “Computer Graphics”, C Version By Hearn and Baker Credits: 6 1.
David Luebke1/5/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
CS COMPUTER GRAPHICS LABORATORY. LIST OF EXPERIMENTS 1.Implementation of Bresenhams Algorithm – Line, Circle, Ellipse. 2.Implementation of Line,
Business and Computing Deanery 3D Modelling Tools Week 3 Transformations, cloning and arrays, modifiers.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
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.
More Object Representations
Rendering Pipeline and Graphics Hardware Aaron Bloomfield CS 445: Introduction to Graphics Fall 2006.
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.
OpenGL LAB III.
3D Ojbects: Transformations and Modeling. Matrix Operations Matrices have dimensions: Vectors can be thought of as matrices: v=[2,3,4,1] is a 1x4 matrix.
IAT 355 Scene Graphs Feb 23, 2017 IAT 355.
Real-time Computer Graphics Overview
Hierarchical and Object-Oriented Graphics
CSCE 441: Computer Graphics: Hierarchical Models
Hierarchical and Object-Oriented Graphics
Hierarchical Modeling & Constructive Solid Geometry
Dr. Chih-Kuo Yeh 葉智國 Computer Graphics Dr. Chih-Kuo Yeh 葉智國
CSCE 441: Computer Graphics: Hierarchical Models
Presentation transcript:

Scene Graphs In 3D Graphics programming the structure used is a scene graph which is special tree structure designed to store information about a scene. Typical elements include –geometries –positional information –lights –fog

Recap 3D scene Camera 2D picture Content of 2D picture will depend on: camera parameters (position, direction, field of view,...), properties of scene objects, illumination,... Camera paradigm for 3D viewing 3D viewing is similar to taking picture with camera: –2D view of 3D scene

Introduction Main steps in 3D graphics viewing: Scene specification View specification –Specification of viewing parameters –Projection: scene mapped onto 2D view window –Clipping: removal of primitives that are outside Display

Coordinate Systems World coordinate system: reference frame for specification of (relative) position / orientation of viewer and scene objects (size?) xwxw zwzw ywyw Scene (head looking at bird) xmxm zmzm ymym Head model xmxm zmzm ymym Bird model

Coordinate Systems Viewing coordinate system: reference frame for specification of scene from viewpoint of camera / viewer xwxw zwzw ywyw xmxm zmzm ymym xmxm zmzm ymym Taking a view of scene (head looking at bird) Camera yvyv zvzv xvxv

xwxw zwzw ywyw World coordinates Viewing Pipeline Coordinate transformations: –generation of 3D view involves sequence (pipeline) of coordinate transformations Camera Modelling coordinates 3D object 2D picture Device coordinates xmxm zmzm ymym xmxm zmzm ymym xmxm zmzm ymym xvxv zvzv yvyv Viewing coordinates

A scene graph is a data structure used to hold the elements that make up a scene. It may be either a tree or a Directed Acyclic Graph (DAG). The tree and DAG are similar, except that in the DAG the branches may possibly grow back together.

Trees Start at the root and move outward towards the leaves. Normally shown with the root at the top and the branches at the bottom. A node is a part of this tree that may have other nodes or leaves underneath it, a leaf cannot have other nodes or leaves under it. There is only one path from a leaf to the root of the tree. There are no "cycles", if you move outward along the branches, you never loop back around to end up at the root again.

Directed acyclic graph (DAG) Directed means that the parent-child relationship is one-way, Acyclic means that there can’t be loops, i.e. child cant be one of its own ancestors Like a tree, except maybe the branches grow back together sometimes, so that following a different sequence of branches outwards from the root might lead you to the exact same leaf. Branches never grow in a loop, though, so as long as you keep moving outwards, you always end up at a leaf eventually:

Nodes The scene graph contains 'nodes' such as shape, light, camera, etc. The tree structure is important because it allows the scope of influence of scene parameters to be clear and unambiguous. Nodes which have an unspecified number of children below them are known as Group nodes. One of the most important type of nodes is a Transform Group, this modifies all of the shapes below it by transforming them via a 4x4 matrix.

The Scene Graph The scene graph captures transformations and object-object relationships in a suitable structure: Robot BodyHead ArmTrunkLegEyeMouth Objects Instancing (i.e, a matrix) Legend World

Traversing the Scene Graph Traverse the scene graph in depth-first order, concatenating and undoing transforms: –For example, to render a robot Apply robot -to-head matrix Apply head -to-mouth matrix –Render mouth Un-apply head-to-mouth matrix Apply head-to-left eye matrix –Render eye Un-apply head-to-left eye matrix Apply head-to-right eye matrix –Render eye Un-apply head-to-right eye matrix Un-apply robot-to-head matrix Apply robot-to-body matrix

The Scene Graph in OpenGL OpenGL maintains a matrix stack of modeling and viewing transformations: ArmTrunk Leg EyeMouth HeadBody Robot Foot Matrix Stack Visited Unvisited Active

OpenGL: The Matrix Stack The user can save the current transformation matrix by pushing it onto the stack with glPushMatrix() The user can later restore the most recently pushed matrix with glPopMatrix() These commands really only make sense when in GL_MODELVIEW matrix mode

OpenGL: Matrix Stack Example glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(…); // save translation matrix: glPushMatrix(); glRotatef(…); // render something translated & rotated: glCallList(foo); // restore pushed matrix, undoing rotation: glPopMatrix(); // render something else, no rotation: glCallList(bar);

Data Structures Let’s have a look at the data structures employed in more detail Selection of data structures for computer graphics often driven by need for efficiency –storage –computation Trade-off between storage and computational efficiency often applied

Data Structures Data structures are required for: –scene specification object, polygon, point / vertex,... –mathematical manipulations vector, matrix, … –graphical display buffer,... Typical data structures: trees / scene graphs, linked lists, arrays

Data Structures Computer graphics often use hierarchical data structures, e.g. Scene ObjectsFacetsVertices Linked list of objects Linked lists of facets Linked lists of vertices Structures with x, y, z coordinates Note: other possible levels: object groups, facet groups (surfaces), edges vertex may also link back to facets which share vertex (for shading)

Data Structures Possible architecture Facet lists Facet M Facet 1 Vertex array Vertices Object list Object 1Object 2Object N Facet list and vertex array

Data Structures Possible structure for 3D point or vertex /* 3D point or vertex with integer coordinates */ typedef struct structTag3DiPoint { intxCoordinate, /* x coordinate */ intxCoordinate, /* x coordinate */ yCoordinate, /* y coordinate */ yCoordinate, /* y coordinate */ zCoordinate; /* z coordinate */ zCoordinate; /* z coordinate */ } int3DPoint, /* 3D point */ } int3DPoint, /* 3D point */ * pInt3DPoint, /* pointer to a 3D point */ * pInt3DPoint, /* pointer to a 3D point */ int3DVertex, /* 3D vertex */ int3DVertex, /* 3D vertex */ * pInt3DVertex; /* pointer to a 3D vertex */ * pInt3DVertex; /* pointer to a 3D vertex */

Data Structures Possible structure for polygon /* Polygon in 3D space */ typedef struct structTag3DiPolygon { int3DVertexi3SidedPoly[3]; int3DVertexi3SidedPoly[3]; intcolour, intcolour,visibilityFlag; floatmagNormal; floatmagNormal; struct structTag3DiPolygon * link2NextPolygon; struct structTag3DiPolygon * link2NextPolygon; /* Other attributes can go here */ /* Other attributes can go here */ }int3DPolygon, /* 3D Polygon */ }int3DPolygon, /* 3D Polygon */ * pInt3DPolygon, /* pointer to a 3D Polygon */ * pInt3DPolygon, /* pointer to a 3D Polygon */ int3DFacet, /* 3D facet */ int3DFacet, /* 3D facet */ * pInt3DFacet; /* pointer to a 3D facet */ * pInt3DFacet; /* pointer to a 3D facet */

Data Structures Possible structure for 3D object /* Object in 3D space */ typedef struct structTag3DiObject { pInt3DFacetpFacetList; pInt3DFacetpFacetList; pInt3DVertexpVertexArray; pInt3DVertexpVertexArray; intnumVertices; intnumVertices; int3DPointworldPosition; int3DPointworldPosition; struct structTag3DiObject * link2NextObject; struct structTag3DiObject * link2NextObject; /* Other attributes can go here */ /* Other attributes can go here */ } int3DObject, /* 3D Object */ } int3DObject, /* 3D Object */ * pInt3DObject; /* pointer to a 3D Object */ * pInt3DObject; /* pointer to a 3D Object */

Data Structures To synthesise copies of an object –master / instance architecture master defines generic attributes of object instance defines attribute values of particular copy Master Instances

Data Structures Possible architecture Masters Instances Object 1 tmatt Object 2 tm att Master 1 car Facet list Edge list Vertex list Object N tm att tm: transf. matrix att: attributes Master M ball Facet list Edge list Vertex list

Tree structures to accommodate scene graphs Binary trees Quad trees Oct trees Child-sibling trees

Using Modelling Software Maya 3d Studio Max VRML generators

Features Primitives Groups Complex, irregular shapes Lines, Points, Facets Curved surfaces Texture mapped surfaces Lighting and Shading Interactions and Behaviours

Primitives Facets constructed from known geometric relationships Uses polygons to map to standard mesh structure Scaling, shearing, rotation and translation used to modify vertex information, vertex ordering remains same

Complex or Irregular objects Manual construction –Lines and vertices positioned by hand/ eye –Modification of primitives –Extrusions Curved surfaces –B-splines –Bezier curves –Parametric meshes –etc

Scene view Scene hierarchy required Must have mechanism to store results Output file structure must link to internal structure –Hierarchy –Relationship between hierarchical nodes –Vertex list –Vertex ordering list –Lighting information –Texture mapping –May also hold recent viewing parameters

3DS File structure May be ASCII output Tags outline structures Must read between Tags Comma delimitation usually to separate vertex list and ordering information