HIERARCHICAL TRANSFORMATIONS A Practical Introduction

Similar documents
HIERARCHICAL TRANSFORMATIONS A Practical Introduction

HIERARCHICAL TRANSFORMATIONS A Practical Introduction

IMAGE-BASED RENDERING AND ANIMATION

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

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

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

Graphics pipeline and transformations. Composition of transformations

RASTERISED RENDERING

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

Computer Graphics Hands-on

Transformations. Rotation and Scaling

TIEA311 Tietokonegrafiikan perusteet kevät 2018

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

SM2231 :: 3D Animation I :: Basic. Rigging

Animation. CS 4620 Lecture 32. Cornell CS4620 Fall Kavita Bala

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

3D Mathematics. Co-ordinate systems, 3D primitives and affine transformations

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

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

Describe the Orthographic and Perspective projections. How do we combine together transform matrices?

CS354 Computer Graphics Character Animation and Skinning

Hierarchical Modeling

2D/3D Geometric Transformations and Scene Graphs

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision

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

Overview. By end of the week:

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

Computer Graphics Hands-on

CS-184: Computer Graphics. Today. Forward kinematics Inverse kinematics. Wednesday, November 12, Pin joints Ball joints Prismatic joints

DH2323 DGI16 Lab2 Transformations

COMP3421. Week 2 - Transformations in 2D and Vector Geometry Revision

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

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

Game Programming. Bing-Yu Chen National Taiwan University

Where We Are: Static Models

Using GLU/GLUT Objects

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

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

Transforms 1 Christian Miller CS Fall 2011

CHAPTER 1 Graphics Systems and Models 3

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

COMPUTER GRAPHICS AND INTERACTION

Lessons from Scene Graphs: Using Scene Graphs to Teach Hierarchical Modeling

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

3D GRAPHICS. design. animate. render

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

Homework 5: Transformations in geometry

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

Lecture 5b. Transformation

CS 4620 Program 3: Pipeline

Chapter 3: Modeling Transformation

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

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

3.2 Hierarchical Modeling

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

Lecture 5: Transforms II. Computer Graphics and Imaging UC Berkeley CS184/284A

COMPSCI 372 S2 C - Assignment 2 Due Date: Monday 22nd September 2008, 9.30pm

3D Modelling: Animation Fundamentals & Unit Quaternions

Computer graphics 2: Graduate seminar in computational aesthetics

Computer Graphics (CS 4731) Lecture 11: Implementing Transformations. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Due: Thursday, February 6 th, 11:59 pm TA: Mason Remy

Inverse Kinematics of a Rhino Robot

Lecture 08: Hierarchical Modeling with Scene Graphs

Articulated Characters

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

Maya Lesson 3 Temple Base & Columns

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

Computer Graphics: Geometric Transformations

CS475/675: Computer Graphics End-Semester Examination (Solutions), Fall 2016

Overview of Projections: From a 3D world to a 2D screen.

Transformations IV. Week 3, Wed Jan 20

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

CS 4620 Midterm 1. Tuesday 22 October minutes

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

KINEMATICS FOR ANIMATION. Rémi Ronfard, Animation, M2R MOSIG

Hierarchical Models Week 9, Lecture 19

CS 184, Fall 1992 MT Solutions Professor Brian A. Barsky

Graphics and Interaction Rendering pipeline & object modelling

CS354 Computer Graphics Rotations and Quaternions

CS451Real-time Rendering Pipeline

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

INTRODUCTION COMPUTER GRAPHICS AND INTERACTION. Christopher Peters. CST, KTH Royal Institute of Technology, Sweden

UNIT 2 2D TRANSFORMATIONS

Today. Parity. General Polygons? Non-Zero Winding Rule. Winding Numbers. CS559 Lecture 11 Polygons, Transformations

Today. Today. Introduction. Matrices. Matrices. Computergrafik. Transformations & matrices Introduction Matrices

Viewing with Computers (OpenGL)

Introduction to Transformations. In Geometry

Lecture 4. Viewing, Projection and Viewport Transformations

Modeling Objects by Polygonal Approximations. Linear and Affine Transformations (Maps)

Linear transformations Affine transformations Transformations in 3D. Graphics 2009/2010, period 1. Lecture 5: linear and affine transformations

Hierarchical Modeling

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

CS 465 Program 4: Modeller

Animation. Keyframe animation. CS4620/5620: Lecture 30. Rigid motion: the simplest deformation. Controlling shape for animation

Transform 1: Translate, Matrices

CMSC 425: Lecture 10 Skeletal Animation and Skinning

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

COMP30019 Graphics and Interaction Rendering pipeline & object modelling

Lecture outline. COMP30019 Graphics and Interaction Rendering pipeline & object modelling. Introduction to modelling

Transcription:

HIERARCHICAL TRANSFORMATIONS A Practical Introduction Christopher Peters CST, KTH Royal Institute of Technology, Sweden chpeters@kth.se https://www.kth.se/profile/chpeters/

Before we begin... Lab work Try to get Lab 1 to build Re-run of lab session 1 if necessary Lab session(s) Will be organised based on class availability Doodle Poll! https://doodle.com/poll/whivr3pidkcx99xn

Transformations Many objects are composed of hierarchies Transformations enable us to compose hierarchies

Geometric primitives (a brief introduction) Graphical objects are composed of primitives More about geometry in subsequent lectures

Transformations Recall translation from previous lecture:

Translating an object Translation operation takes place on a point But a geometric object (mesh) is a collection of vertices How to translate that? Translate each of its vertices

Rotating an object Rotation operation takes place on a point How to rotate a object? The same procedure applies: Rotate each vertex that comprises the object

World space Object specified in Object space (OS) Positioned in world space (WS) via transform Transforms Multiple instances of the same object can be positioned in the world via individual transformations Objects positioned according to their respective object space origins More on this later

Representation Recall: Transformations are represented as 4x4 matrices From the last lecture:

Local Coordinate Marker Nothing is displayed on the screen until you draw an object Transformation matrices are stored in memory How do we keep track of positioning information? One answer: Local Coordinate Marker (LCM) A special coordinate system that we track via pen and graph paper or mentally The LCM represents a transformation matrix But in a manner more intuitive to humans

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Modelview matrix

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Identity matrix Modelview matrix

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Modelview matrix Translate(5,3)

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Modelview matrix Translate(5,3) Draw_Square()

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Translations and rotations concatenate into the current state of the Modelview matrix Modelview matrix Translate(5,3) Draw_Square() Translate(-4,-1)

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Translations and rotations concatenate into the current state of the Modelview matrix Modelview matrix Translate(5,3) Draw_Square() Translate(-4,-1) Displacements

Practical transformations The LCM represents a special transformation matrix Modelview matrix When a geometric object is drawn, it is placed according to the transform defined in the Modelview matrix Translations and rotations concatenate into the current state of the Modelview matrix Modelview matrix Translate(5,3) Draw_Square() Translate(-4,-1) Result

Object space revisited Square1 specified in Object space (OS) Positioning in world space (WS) via transform Initialise( ) Translate(2,2) Rotate(45) Draw_Square 1() Rotations also occur about the origin of the object Default axis of rotation Notice that the transformation is the exact same

Object space revisited Square2 specified in Object space (OS) Positioning in world space (WS) via transform Translate(2,2) Rotate(45) Draw_Square2() Rotations also occur about the origin of the object Default axis of rotation Notice that the transformation is the exact same

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Save our transformation details (position and orientation of the LCM)

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2)

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45)

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45) Draw_Square()

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45) Draw_Square() PopMatrix() Load our previous transformation details (another option in this case: re-initialise the Modelview matrix)

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45) Draw_Square() PopMatrix() Save our transformation details (position and orientation of the LCM)

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45) Draw_Square() PopMatrix() Translate(6,3) Draw_Square()

Saving and loading transformations When positioning multiple objects, saving and loading transformations can be useful Translate(2,2) Rotate(45) Draw_Square() PopMatrix() Translate(6,3) Draw_Square() PopMatrix() Load our previous transformation details (another option in this case: re-initialise the Modelview matrix)

Adding some animation Enter a variable angle for the first rotate Increase it by e.g. 10 degrees at each update x=0 Translate(2,2) Rotate(x) Draw_Square() PopMatrix() Translate(6,3) Draw_Square() PopMatrix() x=x+10 (constrain x to sensible value)

The stack Transformations are saved on and loaded from a stack data structure Saving a matrix = push operation Loading a matrix = pop operation LIFO (last in, first out) Push on to the top of the stack Pop off the top of the stack

Operations summary Initialise an identity transformation Identity matrix (look for functions with similar names to LoadIdentity()) Translate(t x,t y ) Matrix multiplication Rotate(degrees) Usually also specify an axis of rotation In our examples, assume it is (0,0,1) Rotations around the z axis i.e. in the XY plane Save the current Modelview matrix state on stack PopMatrix() Load a previous Modelview matrix state from stack

Introducing hierarchies A tree of separate objects that move relative to each other The positions and orientations of objects further down the tree are dependent on those higher up Parent and child objects Transformations applied to parents are also applied down the hierarchy to their children Examples: 1. The human arm (and body) Hand configuration depends the elbow configuration, depends on shoulder configuration, and so on 2. The Solar system Solar bodies rotate about their own axes as well as orbiting around the Sun (moons around planets, planets around the Sun)

Hierarchies You have already learned the basic operations necessary for hierarchical transformations Recall: up to now, the LCM has been moved back to the world-space origin before placing each object

Hierarchies It s slightly different in a hierarchy Objects depend on others (a parent object) for their configurations (position and orientation) These objects need to be placed relative to their parent objects coordinates, rather than in world-space In practice, this involves the use of nested and PopMatrix()operations Especially when there are multiple branches

Simple chain example Three components A handle Two links In order to define a simple connected chain: Translate the handle location and draw it Translate to the first link and draw it Translate to the second link and draw it Note: we do not translate back to the world-space origin after drawing each component i.e. translations are relative to the respective parent objects Start of Link 1 Handle Link 1 Link 2 Start of Link 2

Step by step In more detail:

Step by step In more detail: Translate(Handle_pos) DrawHandle()

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans)

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang)

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang) Draw_Link1()

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang) Draw_Link1() Translate(Link2_trans)

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang) Draw_Link1() Translate(Link2_trans) Rotate(Link2_ang)

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang) Draw_Link1() Translate(Link2_trans) Rotate(Link2_ang) Draw_Link2()

Step by step In more detail: Translate(Handle_pos) DrawHandle() Translate(Link1_trans) Rotate(Link1_ang) Draw_Link1() Translate(Link2_trans) Rotate(Link2_ang) Draw_Link2() PopMatrix()

Putting it into Practice https://processing.org/...a flexible software sketchbook and a language for learning how to code within the context of visual arts Good for a foray into transformations without the complexity of an IDE OpenGL-based: similar (but less sophisticated) functionality to the framework that you will use in the course Straight forward mapping from operations we covered in this lecture to graphics programming functions