CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Similar documents
CSE 167: Introduction to Computer Graphics Lecture #8: Scene Graph. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

CSE 167: Introduction to Computer Graphics Lecture #9: Scene Graph. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

CSE 167: Introduction to Computer Graphics Lecture #11: Visibility Culling

CSE 167: Introduction to Computer Graphics Lecture #9: Visibility. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2018

Culling. Computer Graphics CSE 167 Lecture 12

Problem Max. Points Total 80

CSE 167: Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Spatial Data Structures

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

CSE 167: Introduction to Computer Graphics Lecture #5: Rasterization. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Speeding up your game

Spatial Data Structures

Ray Tracing: Intersection

Spatial Data Structures

Spatial Data Structures

CSE 167: Introduction to Computer Graphics Lecture 12: Bézier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Spatial Data Structures

CSE 167: Lecture #8: Lighting. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

Adaptive Point Cloud Rendering

CSE 167: Introduction to Computer Graphics Lecture #18: More Effects. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #13: Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Universiteit Leiden Computer Science

Overview. Java and OpenSceneGraph. Introduction. OpenSceneGraph. Introduction Scene graph structure

Total 80

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

CSE 167: Introduction to Computer Graphics Lecture #4: Coordinate Systems

CSE 167: Lecture #17: Procedural Modeling. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

CSE 167: Introduction to Computer Graphics Lecture #19: Wrapping Up. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

Motivation. Culling Don t draw what you can t see! What can t we see? Low-level Culling

Spatial Data Structures and Speed-Up Techniques. Tomas Akenine-Möller Department of Computer Engineering Chalmers University of Technology

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

CSE 167: Lecture #15: Procedural Modeling. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

CSE 167: Introduction to Computer Graphics Lecture #5: Visibility, OpenGL

Lecture 08: Hierarchical Modeling with Scene Graphs

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

COMP 175: Computer Graphics April 11, 2018

CS451Real-time Rendering Pipeline

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

LOD and Occlusion Christian Miller CS Fall 2011

11 - Spatial Data Structures

Computer Graphics. Bing-Yu Chen National Taiwan University

Sign up for crits! Announcments

CSE 167: Introduction to Computer Graphics Lecture #11: Bezier Curves. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

CSE 167: Lecture 11: Textures 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Spatial Data Structures and Speed-Up Techniques. Ulf Assarsson Department of Computer Science and Engineering Chalmers University of Technology

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

Ray Tracing Acceleration Data Structures

CS 465 Program 4: Modeller

Modeling Objects. Modeling. Symbol-Instance Table. Instance Transformation. Each appearance of the object in the model is an instance

CSE 167: Introduction to Computer Graphics Lecture #3: Coordinate Systems

Lecture 18 of 41. Scene Graphs: Rendering Lab 3b: Shader

Ray Tracing. Cornell CS4620/5620 Fall 2012 Lecture Kavita Bala 1 (with previous instructors James/Marschner)

CSE 167: Introduction to Computer Graphics Lecture #5: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2017

CS535 Fall Department of Computer Science Purdue University

CHAPTER 1 Graphics Systems and Models 3

CSE 167: Introduction to Computer Graphics Lecture #3: Projection. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Topic 10: Scene Management, Particle Systems and Normal Mapping. CITS4242: Game Design and Multimedia

CS 563 Advanced Topics in Computer Graphics QSplat. by Matt Maziarz

Ray Tracing with Spatial Hierarchies. Jeff Mahovsky & Brian Wyvill CSC 305

CSE 167: Introduction to Computer Graphics Lecture #6: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2014

EDAF80 Introduction to Computer Graphics. Seminar 1. Hierarchical Transformation. Michael Doggett. Some slides by Carl Johan Gribel,

CSE 167: Introduction to Computer Graphics Lecture #7: Lights. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2015

CSE 167: Lecture #8: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Hidden Surface Elimination Raytracing. Pre-lecture business. Outline for today. Review Quiz. Image-Space vs. Object-Space

Ray Tracing Acceleration. CS 4620 Lecture 20

Intersection Acceleration

Sung-Eui Yoon ( 윤성의 )

More Hidden Surface Removal

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2011

Transformation Hierarchies. CS 4620 Lecture 5

CS 563 Advanced Topics in Computer Graphics Culling and Acceleration Techniques Part 1 by Mark Vessella

Illumination and Geometry Techniques. Karljohan Lundin Palmerius

CSE 167: Introduction to Computer Graphics Lecture #9: Textures. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

Open Scene Graph Lecture Note #1

CS 4620 Program 4: Ray II

Acceleration Data Structures

Scene Graphs. COMP 575/770 Fall 2010

Last Time: Acceleration Data Structures for Ray Tracing. Schedule. Today. Shadows & Light Sources. Shadows

View-dependent Polygonal Simplification

CSE 167: Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2016

Terrain rendering (part 1) Due: Monday, March 10, 10pm

CPSC / Sonny Chan - University of Calgary. Collision Detection II

Graphics and Interaction Rendering pipeline & object modelling

Comparison of hierarchies for occlusion culling based on occlusion queries

Acceleration Data Structures for Ray Tracing

A Real-time Rendering Method Based on Precomputed Hierarchical Levels of Detail in Huge Dataset

S U N G - E U I YO O N, K A I S T R E N D E R I N G F R E E LY A VA I L A B L E O N T H E I N T E R N E T

3D Rendering Pipeline

Computer Graphics Ray Casting. Matthias Teschner

Visibility and Occlusion Culling

Transcription:

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2 Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Announcements Homework project #5 due Nov. 8 th at 1:30pm To be presented in labs 260/270 Monday is Veterans Day Homework introduction rescheduled to Tuesday after class 2

Lecture Overview Scene Graphs & Hierarchies Introduction Data structures Performance Optimization Level-of-detail techniques View Frustum Culling 3

Sample Class Hierarchy Node Group Geode MatrixTransform Switch Sphere Billboard Inspired by OpenSceneGraph 4

Class Hierarchy Node Common base class for all node types Stores node name, pointer to parent, bounding box Group Stores list of children Geode Geometry Node Knows how to render a specific piece of geometry 5

Class Hierarchy MatrixTransform Derived from Group Stores additional transformation M Transformation applies to sub-tree below node Monitor-to-world transformation M 0 M 1 World Star M 0 Planet M 1 6 Moon A Moon B

Class Hierarchy Switch Derived from Group node Allows hiding (not rendering) all or subsets of its child nodes Can be used for state changes of geometry, or key frame animation M 1 Moon Visible Moon Infrared 7

Class Hierarchy Sphere Derived from Geode Pre-defined geometry with parameters, e.g., for tesselation level, solid/wireframe, etc. Billboard Special geometry node to display an image always facing the viewer Sphere at different tessellation levels 8 Billboarded Tree

Solar System Star World Rotation Planet 1 Planet 2 Rotation Rotation Moon A Moon B Moon C Moon D 9

Source Code for Solar System world = new Group(); world.addchild(new Star()); rotation0 = new MatrixTransform( ); rotation1 = new MatrixTransform( ); rotation2 = new MatrixTransform( ); world.addchild(rotation0); rotation0.addchild(rotation1); rotation0.addchild(rotation2); rotation0.addchild(new Planet( 1 )); rotation0.addchild(new Planet( 2 )); rotation1.addchild(new Moon( A )); rotation1.addchild(new Moon( B )); rotation2.addchild(new Moon( C )); rotation2.addchild(new Moon( D )); Star Planet 1 Moon A Rotation 1 Moon B World Rotation 0 Moon C Planet 2 Rotation 2 Moon D 10

Basic Rendering Traverse the tree recursively Group::draw(Matrix4 C) { for all children draw(c); } MatrixTransform::draw(Matrix4 C) { C_new = C*M; // M is a class member for all children draw(c_new); } Geode::draw(Matrix4 C) { setmodelview(c); render(myobject); } Initiate rendering with world->draw(identity); 11

Modifying the Scene Change tree structure Add, delete, rearrange nodes Change node parameters Transformation matrices Shape of geometry data Materials Create new node subclasses Animation, triggered by timer events Dynamic helicopter-mounted camera Light source Create application dependent nodes Video node Web browser node Video conferencing node Terrain rendering node 12

Benefits of a Scene Graph Can speed up rendering by efficiently using low-level API Avoid state changes in rendering pipeline Render objects with similar properties in batches (geometry, shaders, materials) Change parameter once to affect all instances of an object Abstraction from low level graphics API Easier to write code Code is more compact Can display complex objects with simple APIs 13 Example: osgearth class provides scene graph node which renders a Google Earth-style planet surface

Lecture Overview Scene Graphs & Hierarchies Introduction Data structures Performance Optimization Level-of-detail techniques View Frustum Culling 14

Level-of-Detail Techniques Don t draw objects smaller than a threshold Small feature culling Popping artifacts Replace 3D objects by 2D impostors Textured planes representing the objects Adapt triangle count to projected size Impostor generation Original vs. impostor 15 Size dependent mesh reduction (Data: Stanford Armadillo)

View Frustum Culling Frustum defined by 6 planes Each plane divides space into outside, inside Check each object against each plane Outside, inside, intersecting If outside all planes Outside the frustum If inside all planes Inside the frustum Else partly inside and partly out Efficiency View frustum 16

Bounding Volumes Simple shape that completely encloses an object Generally a box or sphere We use spheres Easiest to work with But hard to calculate tight fits Intersect bounding volume with view frustum instead of each primitive 17

Distance to Plane A plane is described by a point p on the plane and a unit normal n Find the (perpendicular) distance from point x to the plane r n x p 18

Distance to Plane The distance is the length of the projection of x-p onto n uuuuuuu r r dist = x p n ( ) r n x uuuuu p r x p 19

Distance to Plane The distance has a sign positive on the side of the plane the normal points to negative on the opposite side zero exactly on the plane Divides 3D space into two infinite half-spaces uuuuuuu r r r dist(x) = ( x p) n n Positive p 20 Negative

Distance to Plane Simplification d is independent of x d is distance from the origin to the plane We can represent a plane with just d and n 21

Frustum With Signed Planes Normal of each plane points outside outside means positive distance inside means negative distance 22

Test Sphere and Plane For sphere with radius r and origin x, test the distance to the origin, and see if it is beyond the radius Three cases: dist(x)>r completely above dist(x)<-r completely below -r<dist(x)<r intersects r n Positive Negative 23

Culling Summary Precompute the normal n and value d for each of the six planes. Given a sphere with center x and radius r For each plane: if dist(x) > r: sphere is outside! (no need to continue loop) add 1 to count if dist(x)<-r If we made it through the loop, check the count: if the count is 6, the sphere is completely inside otherwise the sphere intersects the frustum (can use a flag instead of a count) 24

Culling Groups of Objects Want to be able to cull the whole group quickly But if the group is partly in and partly out, want to be able to cull individual objects 25

Hierarchical Bounding Volumes Given hierarchy of objects Bounding volume of each node encloses the bounding volumes of all its children Start by testing the outermost bounding volume If it is entirely outside, don t draw the group at all If it is entirely inside, draw the whole group 26

Hierarchical Culling If the bounding volume is partly inside and partly outside Test each child s bounding volume individually If the child is in, draw it; if it s out cull it; if it s partly in and partly out, recurse. If recursion reaches a leaf node, draw it normally 27

Hierarchical Culling: Octree Octrees are the three-dimensional analog of quadtrees. An octree is a tree data structure in which each node has exactly eight children. Most often used to partition a 3D space by recursively subdividing it into eight octants. 28 Source: Wikipedia

Video An OpenGL Demo - Frustum Culling with Octree http://www.youtube.com/watch?v=h-ssvzzv1sw 29