Hierarchical Modeling

Similar documents
Hierarchical Modeling and Scene Graphs

Hierarchical Modeling and Scene Graphs

Hierarchical Modeling and scene graphs

Hierarchical Modelling

Graphical Objects and Scene Graphs

Hierarchy I. Guoying Zhao 1 / 40

Hierarchical Modeling I. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Hierarchical Modeling. University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell

Hierarchical Models Week 9, Lecture 19

Hierarchical Modeling II. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Hierarchical Modeling. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

CS354 Computer Graphics Character Animation and Skinning

Hierarchical Modeling. CS 432 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

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

Reading. Hierarchical Modeling. Symbols and instances. Required: Angel, sections , 9.8. Optional:

Game Programming. Bing-Yu Chen National Taiwan University

Transformations. Rotation and Scaling

Computer Graphics (CS 543) Lecture 6a: Hierarchical 3D Models. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Hierarchical Modeling

Two possible ways to specify transformations. Each part of the object is transformed independently relative to the origin

COMP 175 COMPUTER GRAPHICS. Lecture 07: Scene Graph. COMP 175: Computer Graphics March 10, Remco Chang 07 Scene Graph

Using GLU/GLUT Objects

3.2 Hierarchical Modeling

Where We Are: Static Models

Transforms 1 Christian Miller CS Fall 2011

Computer graphics MN1

Lecture 08: Hierarchical Modeling with Scene Graphs

Scene Graphs. CS4620/5620: Lecture 7. Announcements. HW 1 out. PA 1 will be out on Wed

6.837 Computer Graphics Hierarchical Modeling Wojciech Matusik, MIT EECS Some slides from BarbCutler & Jaakko Lehtinen

CS4202: Test. 1. Write the letter corresponding to the library name next to the statement or statements that describe library.

6.837 Introduction to Computer Graphics Assignment 5: OpenGL and Solid Textures Due Wednesday October 22, 2003 at 11:59pm

CS 428: Fall Introduction to. Transformations in OpenGL + hierarchical modeling. Andrew Nealen, Rutgers, /21/2009 1

CSE Real Time Rendering Week 10

Translation. 3D Transformations. Rotation about z axis. Scaling. CS 4620 Lecture 8. 3 Cornell CS4620 Fall 2009!Lecture 8

CS 4204 Computer Graphics

HIERARCHICAL TRANSFORMATIONS A Practical Introduction

OpenGL Transformations

Computer Graphics Geometric Transformations

MODELING AND HIERARCHY

CHAPTER 1 Graphics Systems and Models 3

CS451Real-time Rendering Pipeline

TIEA311 Tietokonegrafiikan perusteet kevät 2018

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

This week. CENG 732 Computer Animation. Warping an Object. Warping an Object. 2D Grid Deformation. Warping an Object.

Graphics pipeline and transformations. Composition of transformations

Lecture 5: Viewing. CSE Computer Graphics (Fall 2010)

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

2D/3D Geometric Transformations and Scene Graphs

Hierarchical Models. Roadmap. Importance of shadows. Importance of shadows. Importance of shadows. Importance of shadows

Spring 2013, CS 112 Programming Assignment 2 Submission Due: April 26, 2013

Introduction to OpenGL Transformations, Viewing and Lighting. Ali Bigdelou

Pipeline Operations. CS 4620 Lecture 14

Models and Architectures

OUTLINE. Hierarchical Models Z-Fighting Primitives Besides Triangles Back Face Culling

OpenGL: Setup 3D World

Hierarchical Modeling: Tree of Transformations, Display Lists and Functions, Matrix and Attribute Stacks,

CS 130 Final. Fall 2015

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

CS 4620 Program 3: Pipeline

CIS 636 Interactive Computer Graphics CIS 736 Computer Graphics Spring 2011

Fachhochschule Regensburg, Germany, February 15, 2017

Chapter 3: Modeling Transformation

Introduction to 3D Graphics with OpenGL. Z-Buffer Hidden Surface Removal. Binghamton University. EngiNet. Thomas J. Watson

CS 352: Computer Graphics. Hierarchical Graphics, Modeling, And Animation

Using GLU/GLUT Objects. GLU/GLUT Objects. glucylinder() glutwirecone() GLU/GLUT provides very simple object primitives

ME5286 Robotics Spring 2014 Quiz 1 Solution. Total Points: 30

we now have a good understanding of 3d representations, rigid body transforms, camera projections, and the fixed function steps in graphics

Viewing with Computers (OpenGL)

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

CSE 690: GPGPU. Lecture 2: Understanding the Fabric - Intro to Graphics. Klaus Mueller Stony Brook University Computer Science Department

CMSC427 Final Practice v2 Fall 2017

Surface Graphics. 200 polys 1,000 polys 15,000 polys. an empty foot. - a mesh of spline patches:

Speeding up your game

Affine Transformations in 3D

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Outline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)

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

Project 2: 3D transforms and Cameras

CS559 Computer Graphics Fall 2015

Rigging / Skinning. based on Taku Komura, Jehee Lee and Charles B.Own's slides

Computer Graphics. Prof. Feng Liu. Fall /21/2016

CSE Intro to Computer Graphics. ANSWER KEY: Midterm Examination. November 18, Instructor: Sam Buss, UC San Diego

Rendering Pipeline and Coordinates Transforms

EECE 478. Learning Objectives. Learning Objectives. Linear Algebra and 3D Geometry. Linear algebra in 3D. Coordinate systems

CSC 470 Computer Graphics

Ray Tracer Due date: April 27, 2011

Kinematics and Orientations

CS354 Computer Graphics Viewing and Modeling

Luiz Fernando Martha André Pereira

Transformations IV. Week 3, Wed Jan 20

Midterm Exam CS 184: Foundations of Computer Graphics page 1 of 11

OpenGL: Open Graphics Library. Introduction to OpenGL Part II. How do I render a geometric primitive? What is OpenGL

API for creating a display window and using keyboard/mouse interations. See RayWindow.cpp to see how these are used for Assignment3

Transformations. CSCI 420 Computer Graphics Lecture 4

Game Architecture. 2/19/16: Rasterization

Rasterization Overview

Computer Graphics I Lecture 11

Hidden Surface Removal. 3D Graphics with OpenGL. Back-Face Culling

CS 559 Computer Graphics Midterm Exam March 22, :30-3:45 pm

Computer Graphics I. Midterm Examination. October 23, This is a closed-book exam; only one double-sided sheet of notes is permitted.

Transcription:

Hierarchical Modeling

Geometric Primitives Remember that most graphics APIs have only a few geometric primitives Spheres, cubes, triangles, etc These primitives are instanced in order to apply transforms

Instance Transforms We start with a prototype object (symbol) Each appearance of the object is an instance Instance defines transforms: Scale, rotate, translate, etc

Relationships between Instances Objects often consist of sub-objects Consider: A car chassis has four wheels 2 symbols 5 instances Rotational wheel speed determines forward motion How to represent this?

Graphs Set of nodes and edges Edge connects a pair of nodes Direction reflects relationship Any problems with this?

Graphs Graph should be acyclic! loop What might our car representation look like?

Directed Acyclic Graph

Trees (Same idea as the DAG) What information is encoded in the nodes and edges?

Modeling with Trees Nodes contain: What to draw Drawing attributes Pointers to children Edges can contain: Geometric transformations (or can be stored in node)

Consider this Robot Arm 3 degrees of freedom: Base rotates about its vertical axis by θ Upper arm rotates in its xy-plane by φ Lower arm rotates in its xy-plane by ψ h 1 h 2 h 3

Relationships in Robot Arm Base rotates independently Position depends on θ Lower arm attached to base Position depends on θ Position depends on φ Upper arm attached to lower arm Position depends on θ Position depends on φ Position depends on ψ

In-Class Activity Draw a tree structure that represents this robot arm Define the matrices at each joint (edge) that will position the robot parts correctly

Robot Tree Model Example

Robot Transform Matrices Example Rotation of base: R b Apply M = R b to base Translate lower arm relative to base: T lu Rotate lower arm around joint: R lu Apply M = R b T lu R lu to lower arm Translate upper arm relative to upper arm: T uu Rotate upper arm around joint: R uu Apply M = R b T lu R lu T uu R uu to upper arm

OpenGL Code robot_arm(){ glm::rotate(theta, 0.0, 1.0, 0.0); base(); glm::translate(0.0, h1, 0.0); glm::rotate(phi, 0.0, 0.0, 1.0); lower_arm(); glm::translate(0.0, h2, 0.0); glm::rotate(psi, 0.0, 0.0, 1.0); upper_arm(); }

Humanoid Example

Transformation Matrices There are 10 relevant matrices: M positions and orients entire figure through torso (root node) M h positions head wrt torso M lua, M rua, M lul, M rul position arms and legs wrt torso M lla, M rla, M lll, M rll position lower parts of limbs wrt corresponding upper limbs

Display and Traversal Display a tree via graph traversal: Visits each node once Applies correct transformation matrix for position and orientation

Stack-based Traversal Set model-view matrix to M and draw torso Set model-view matrix to MM h and draw head For left-upper arm need MM lua and so on Rather than recomputing MM lua from scratch or using an inverse matrix, we can use the matrix stack to store M and other matrices as we traverse the tree

Fixed Function Example glpushmatrix() torso(); glrotate3f( ); head(); glpopmatrix(); glpushmatrix(); gltranslate3f( ); glrotate3f( ); left_upper_arm(); glpopmatrix(); glpushmatrix();

glpushmatrix and glpopmatrix Now deprecated functions handled matrix stacks glpushmatrix() duplicates current matrix and adds to stack glpopmatrix() removes current matrix and replaces it with one below Note that there is no direct replacement in Modern OpenGL you must manage your own matrix stacks!

In-Class Activity Consider what sort of information should be stored in a tree to handle hierarchical modeling and how to traverse this tree in order to apply all transformations in the correct order

OpenGL and Objects Note that OpenGL lacks object orientation Properties determined by OpenGL state rather than object characteristics

Imperative Model cube data Application glrotate results Representation stored within application Representation provides information (e.g vertex list, edge list) for functions to calculate results

Object-Oriented Model Application message Cube Object Representation stored within object Application passes message to object Object has necessary information to transform itself

C/C++ C allows structs for building objects C++ provides more comprehensive support Class construct Support for public, private, protected members

Cube Object Example Creating functionality for scaling, orienting, positioning and coloring a cube object: cube mycube; mycube.color[0]=1.0; mycube.color[1]= mycube.color[2]=0.0; mycube.matrix[0][0]=

Cube Object Functions Use functions to apply changes within the class: 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); mycube.render();

Cube Class Example class cube { public: float color[3]; float matrix[4][4]; // public methods } private: // implementation

Private Implementation Implementation of object (e.g. vertex lists etc) should generally be kept private Using an object should not require understanding the implementation (Basic OO concepts still apply!)

Other Objects Objects can have geometric aspects: Cameras Light sources Objects can also be non-geometric: Materials Colors Transformations

Application Code Example cube mycube; material plastic; mycube.setmaterial(plastic); camera frontview; frontview.position(x,y, z);

Light Object Example 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]; }

Scene Descriptions Hierarchical modeling used to structure and manipulate object s underlying form This idea can be applied to greater scene and its elements (cameras, lights, materials, geometry etc) Render this scene via tree traversal

Scene Graphs