Transforming 3D Models: Hierarchies and Transformation Nodes, Study notes of Computer Graphics

How to create and manipulate static 3d models using transformation nodes and hierarchies. The concept of different coordinate spaces, the importance of breaking models into components, and the use of matrix stacks for managing transformations. It also discusses the need for parameterizing movement and building hierarchies, as well as implementing transformation nodes and manipulating them through user control parameters.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-plu
koofers-user-plu 🇺🇸

10 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Static Models
Our models are static sets of polygons
We can only move them via transformations
translate, scale, rotate, or any other 4x4 matrix
This does not allow us to simulate very realistic motion
So how do we fix this?
A Multitude of Spaces
Recall that transformations move us
between different coordinate spaces
Vertices move through many spaces
We change spaces for convenience
as with the view transform
e1
e2e1
e2
Object Space
World Space
Eye Space
Clip Space
Normalized Device Coordinates
Window Coordinates
Model Transform
View Transform
Projection
Perspective Division
Viewport Transform
First Step: Break the thing Apart
Model object as hierarchy of components
each object node has a local coordinate
system
each component defined relative to
parent
each one can move
and they move relative to parent
How do they move?
with transformations
Body
Upper Head Lower
L Arm Torso R Arm
Introduce Transformation Nodes
Traverse hierarchy during draw
object nodes: draw them
transform nodes
multiply into current matrix on way down
remove from current matrix on way up
Constantly changing local coordinate system
Allows changes at different scales
apply rotation above “Body”
vs. rotation above “L Arm”
Body
Upper
L Arm
body
M
upper
M
larm
M
Current Matrix
body
MM
body upper
MM M⋅⋅
body upper larm
MM M M⋅⋅
pf3
pf4
pf5

Partial preview of the text

Download Transforming 3D Models: Hierarchies and Transformation Nodes and more Study notes Computer Graphics in PDF only on Docsity!

Static Models Our models are static sets of polygonsWe can only move them via transformations

  • translate, scale, rotate, or any other 4x4 matrix This does not allow us to simulate very realistic motionSo how do we fix this?

A Multitude of Spaces Recall that transformations move usbetween different coordinate spacesVertices move through many spacesWe change spaces for convenience

  • as with the view transform

e^1

e^2

e

1

e

2

Object SpaceWorld SpaceEye SpaceClip Space

Normalized Device Coordinates

Window Coordinates

Model TransformView TransformProjectionPerspective DivisionViewport Transform

First Step: Break the thing Apart Model object as hierarchy of components

  • each object node has a local coordinate

system

  • each component defined relative to

parent

  • each one can move• and they move relative to parent How do they move? - with transformations

Body

Upper

Head

Lower

L Arm

Torso

R Arm

Introduce Transformation Nodes Traverse hierarchy during draw

  • object nodes: draw them• transform nodes
    • multiply into current matrix on way down– remove from current matrix on way up

Constantly changing local coordinate systemAllows changes at different scales

  • apply rotation above “Body”• vs. rotation above “L Arm”

Body Upper L Arm

body M

upper M

larm M

Current Matrix

body

M

M ⋅

body

upper

M

M

M

⋅^

body

upper

larm

M

M

M

M

⋅^

⋅^

Parameterizing Movement So how do we control the movement of parts?We have all these transformation nodes

  • 4x4 matrix = 16 coefficients• obviously don’t want to specify manually! Could just specify sets of rotate, translate, scale - much handier• but still lacks one crucial thing — things might fall apart

Parameterizing Movement We want to link things with jointsExample for a shoulder

  • specify corresponding points that remain together• provide a joint angle parameter• just like building people with cardboard cut-outs Construct transform from parameters

θ

Building Hierarchies We need some good way to build them

  • manual manipulation — select objects and hit “Group” button• graph layout — draw graphs directly• textual description of hierarchy• write scripts to generate hierarchy And we need to manipulate the transformations - type in rotate, scale, translate values• attach parameters to GUI elements (e.g., sliders)• write little procedural controllers - for instance, “increment angle every 1.3 seconds”– acts sort of like a motor

Matrix Stacks Instead of a current matrix, we need a matrix stack

  • current matrix is just the top of the stack Stack operations - PUSH — duplicate matrix on top

glPushMatrix()

  • POP — remove matrix on top

glPopMatrix()

When traversing hierarchies

  • PUSH on entering transformation node• multiply transformation into current matrix• descend to children• POP when returning up the tree

Push

Mult. B

Pop

A

A A

ABA

A

Placing the Shoulder Fourth: put shoulder in right spotAnd we’re done!Important things to notice

  • presents limited control knobs• automatically handle interconnection

(6) translate – e.g., elbow joint

( ) t

1

2

e

e

w

s^

t

L

U

Exercise: Converting to Hierarchy

2 (^

(1) translate(2) rotate

θ

e ( 1

(3) translate

e (^

(4) translate(5) rotate

φ

s ( )

(6) translate

t

L

U

trans

t

What’s the hierarchy toput in here?

Converting to Transformation Hierarchy

2 (^

(1) translate(2) rotate

θ

e ( 1

(3) translate

e (^

(4) translate(5) rotate

φ

s ( )

(6) translate

t

L

trans –

e

2

rotate

θ

trans

e

1

U

trans -

s

rotate

φ

trans

t

Notable Properties of Transform Hierarchy

Geometry is always at the leaves

  • internal nodes are transforms There are 2 types of transforms - structural (shown in gray) - fixed at design time– keeps things together - control knobs (shown in blue) - variable parameters– controlled by user

L

trans –

e

2

rotate

θ

trans

e

1

U

trans -

s

rotate

φ

trans

t

Scene Graphs This idea can be extended to the whole scene

  • collect every object into a single hierarchy Provides several nice advantages - natural way of defining bounding volumes for culling• can instance same model in many places - but graph is no longer a tree– it’s a more general DAG - can introduce new node types also - light nodes– material nodes

Truck

Parking Lot

Street

OpenGL State Stack In OpenGL, you can also push/pop state variables

  • glPushAttrib(…)• glPopAttrib() Pass to glPushAttrib() a bitfield describing what to push - GL_ALL_ATTRIB_BITS• GL_ENABLE_BIT — everything set by glEnable• GL_LIGHTING_BIT — light position, colors, materials, …• GL_CURRENT_BIT — current color, normal, …• and several others

How to Generate Animation? We can create & parameterize models now

  • design the geometry• set up a bunch of control knobs (e.g., joint angles) But how do we animate these models - don’t want to manually tweak transformation parameters We’ll specify parameters as functions of time - but we need to do this conveniently - no writing out explicit polynomial functions