75
MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

Embed Size (px)

Citation preview

Page 1: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 1

Inventor modeling and Scene Graph

MIT EECS 6.837

Frédo Durand and Seth Teller

Page 2: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 2

Calendar

• Assignment 1: Due Friday 20 at 5pm

• Final projects will be due December 4

• Defense and presentation until December 10

• Dates can vary +/- 2days

Page 3: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 3

Hierarchical models

Page 4: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 4

Hierarchical models

Page 5: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 5

Hierarchical models

Page 6: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 6

Hierarchical models

Page 7: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 7

Hierarchical models

Page 8: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 8

Hierarchical models

Page 9: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 9

Hierarchical models

Page 10: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 10

Overview of Inventor• A suite of tools

– Viewer(s)– Utilities

• An API– C++ set of classes for 3D display and

manipulation

• File format– ASCII or binary– Later became VRML

• Virtual Reality Modeling Language• Internet 3D format

Page 11: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 11

Demo

• View models• Show application developed under

inventor• Look at .iv file

Page 12: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 12

Hierarchical modeling & scene graph• Define relative layout of objects

• Basic idea: Hierarchical Tree

• Useful abstraction

• Useful for manipulation– Especially for articulated figures

• Useful for rendering too

• Heavy use of transformations– World/object space

Page 13: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 13

Questions?

Page 14: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 14

Today: Inventor modeling

• A simple modeling example

• Inventor tools

• Inventor representation

• More complex objects

Page 15: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 15

Object and World Space Modeling• Object space a sort of “workbench"

wherecomponents are assembled, combined

• World space is a “canvas" on/in whichfinished objects are placed

• But: often useful to view both ways• Usually, required transformations,

ordering obvious• Example: Boat, sub, articulated

grasper arm, treasure

Page 16: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 16

Simple modeling

• Model a boat with an articulated grasp arm

Page 17: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 17

Simple bottom-up modeling

• Model a boat with an articulated grasp arm

Page 18: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 18

Modeling the boat# boat, version 1Switch { DEF boat Separator {

Material { diffuseColor 1 0 0 } # RGB (red)Coordinate3 {

point [ 0 0 0, 5 0 0, 7 2 0, 4 2 0,

4 1.5 0, 1.5 1.5 0, 1.5 2 0, 0 2 0]} # Coordinate3IndexedFaceSet {

coordIndex [ 0, 1, 2, 3, 4, 5, 6, 7, -1 ] }

} } # Switch

Page 19: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 19

Modeling the robot arm

# grasperSwitch { DEF grasper Separator {

Material { diffuseColor 0 1 1 }Coordinate3 {

point [ -2 -1 0, -0.5 -1 0, 0.5 -1 0, 2 -1 0, 1.5 3 0, 1 3 0, 1 1 0, 0.5 1 0, -0.5 1 0, -1 1 0, -1 3 0, -1.5 3 0 ]

} # Coordinate3IndexedFaceSet {

coordIndex [ 0, 1, 8, 9, 10, 11, -1, 2, 3, 4, 5, 6, 7, -1 ] }

} } # Switch

Page 20: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 20

Exploit symmetry

# grasper alternativeSwitch { DEF grasper Separator {

Material { diffuseColor 0 1 1 }Coordinate3 {

point [ -2 -1 0, -0.5 -1 0, -0.5 1 0, -1 1 0, -1 3 0, -1.5 3 0 ]

} # Coordinate3FaceSet { numVertices [ 6 ] }Scale { scaleFactor -1 1 1 } # why ?FaceSet { numVertices [ 6 ] }

} } # Switch

Page 21: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 21

Forearm (with use of grasper)

# forearmSwitch { DEF forearm Separator {

Material { diffuseColor 1 0 1 } # magentaCoordinate3 {

point [ 0 -0.5 0, 4 -0.5 0,4 0.5 0, 0 0.5 0 ]

} # Coordinate3IndexedFaceSet { coordIndex [ 0, 1, 2, 3, -1 ] }# instance grasperTranslation { translation 3.5 0 0 }RotationXYZ { axis Z angle -1 }USE grasper

} } # Switch

Page 22: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 22

Arm (uses forearm that uses grasper)

# armSwitch { DEF arm Separator {

Material { diffuseColor 1 0.5 0 }Coordinate3 { point [ 0 -0.5 0, 4 -0.5 0,

4 0.5 0, 0 0.5 0 ]} # Coordinate3IndexedFaceSet { coordIndex [ 0, 1, 2, 3, -1 ] }# instance forearmTranslation { translation 3.5 0 0 }Scale { scaleFactor 0.5 0.5 0 }RotationXYZ { axis Z angle -0.25 } # joint angle wrt. mountUSE forearm

} } # Switch

Page 23: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 23

Robot (uses…)

# robotSwitch { DEF robot Separator {

Material { diffuseColor 0 1 0 }Coordinate3 { point [ 0 0 0, 2 0 0, 3 1 0,

2 2 0, 0 2 0 ]} # Coordinate3IndexedFaceSet { coordIndex [ 0, 1, 2, 3, 4, -1 ] }# instance entire armTranslation { translation 2 1 0 }Scale { scaleFactor 0.5 0.5 0 }RotationXYZ { axis Z angle 0.5 } # joint angle wrt. mountUSE arm

} } # Switch

Page 24: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 24

Placing robot on boat

# boat, version 2Switch { DEF boat Separator {

Material { diffuseColor 1 0 0 }Coordinate3 {point [ 0 0 0, 5 0 0,

7 2 0,4 2 0, 4 1.5 0, 1.5 1.5 0, 1.5 2 0, 0 2 0]

} # Coordinate3IndexedFaceSet { coordIndex [ 0, 1, 2, 3, 4, 5, 6, 7, -1 ] }# instance robot wrt boatTranslation { translation 5 2 0 } # on board (up)Scale { scaleFactor 0.5 0.5 0 }USE robot

} } # Switch

Page 25: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 25

Gold coin# coinSwitch { DEF coin Separator {

Material { diffuseColor 0.8 0.6 0 } # goldCoordinate3 { point [ -1 -2 0, 1 -2 0, 2 -1 0,

2 1 0, 1 2 0, -1 2 0, -2 1 0, -2 -1 0 ]} # Coordinate3FaceSet { numVertices [ 8 ] }

} } # Switch

Page 26: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 26

Placing coin and robot in the ocean# boat, version 3Switch { DEF boat Separator {

...# instance robot sub wrt boatTranslation { translation 1.5 -4 0 } # divingScale { scaleFactor 0.5 0.5 0 }USE robot

} } # Switch# place boat on sea surfaceSeparator { Translation { translation -8 -0.5 0 }

Scale { scaleFactor 2.5 2.5 0 }USE boat }

# place coin on sea bottomSeparator { Translation { translation 3 -10 0 }

Scale { scaleFactor 0.25 0.25 0 }USE coin }

Page 27: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 27

How to grasp the coin?

Page 28: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 28

Questions?

Page 29: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 29

Today: Inventor modeling

• A simple modeling example

• Inventor tools

• Inventor representation

• More complex objects

Page 30: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 30

Inventor tools

• SceneViewer

Page 31: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 31

Interaction

• Interaction Modes & Icons

• Default: 3D Viewer (hand icon)

• Trackball, Walk, Fly, Plane view• Also Select, Help, Home, Set Home,• Center, Set Center, Ortho/Perspective

Page 32: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 32

Selection

Page 33: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 33

Manipulators

• Trackball

• Tab Box

• Jack

Page 34: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 34

Light Creation/Editing

• Point, Directional, Spot

Page 35: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 35

Material / Color Editing

• Editors – Material, Color

• Enabled only when some entity is selected

Page 36: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 36

Questions?

Page 37: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 37

Today: Inventor modeling

• A simple modeling example

• Inventor tools

• Inventor representation

• More complex objects

Page 38: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 38

Inventor Representations

• Basic idea: Tree• Comprised of several node types:

– Shape: 3D geometric objects– Transform:

Affect current transformation– Property: Appearance, texture, etc.– Group: Collection of subgraphs

Page 39: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 39

Inventor Representations

• In fact, Scene graph• Directed Acyclic Graph (DAG)• Allows multiple instantiations• Cycle forbidden

– because infinite recursions

Page 40: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 40

Traversal

• Breadth first– Top to bottom, left to right

Page 41: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 41

Traversal State

• The State is updated during traversal– Transformations, properties– Influence of nodes can be complex – E.g. bottom to top

Page 42: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 42

Built-In Geometric Primitives• Trivial example:#Inventor V2.1 asciiCube {}

Primitive attributes:Default W,H,D (for cubes, spheres, cones,

etc.);Default Color; Material; etcTraversal state (all defaulted for now):Transform; Lights; Material; etc.

Page 43: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 43

Definition & InstantiationSwitch { DEF unitcube Cube {}} # Switch

Separator {Scale { scaleFactor 1 1 2 }USE unitcube

} # Separator

Page 44: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 44

Useful scene graph: AxesSeparator {

Translation { translation 2 0 0 }Scale { scaleFactor 4.0 0.25 0.25 }Material { diffuseColor 1 0 0 }Cube {}

} # SeparatorSeparator {...Material { diffuseColor 0 1 0 }Cube {}} # Separator...Separator {... Sphere {}} # Separator

Page 45: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 45

Persistence of Traversal State

# place two boats on surface (surprising result ?)Separator {

Translation { translation -8 3 0 }USE boatTranslation { translation 2 3 0 }USE boat

}

Page 46: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 46

Separator Nodes

# place two boats on surface (expected result)Separator {

Translation { translation -8 3 0 }USE boat

}Separator {

Translation { translation 2 3 0 }USE boat

}

Pushes (saves) state when encountered

Pops (restores) state when encountered

Page 47: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 47

Composing Transformations...

Separator {Rotation { rotation 0 0 1 0.5 }

# axis, angleTranslation { translation 3 0 0 }USE boat

} # Separator

...Separator {

Translation{ translation 3 0 0 }Rotation { rotation 0 0 1 0.5 }

# axis, angleUSE boat

} # Separator

Page 48: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 48

Material Properties

To color with “intrinsic material“(constant color):...LightModel { model BASE_COLOR }File { name "coordaxes.iv" }Separator {

Material { diffuseColor 0.8 0.0 0.0 }Sphere {}

} # Separator

Page 49: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 49

Using a Lighting ModelTo shade with “lighting model":

...LightModel { model PHONG }DirectionalLight {

intensity 1color 1 1 1direction -1 -1 -1 # "shining" this dir

}Separator {

Material {diffuseColor 0.25 0.25 0.25specularColor 0.8 0.8 0.8shininess 0.9

} # MaterialSphere {}

} # Separator

Page 50: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 50

Polyhedral ObjectsSeparator {

Coordinate3 {point [ -1 1 1, -1 -1 1, 1 -1 1, 1 1 1,

-1 1 -1, -1 -1 -1, 1 -1 -1, 1 1 -1 ]} # Coordinate3

IndexedFaceSet { # multiple facescoordIndex [ 0, 1, 2, 3, -1, # vertex ids, -1

ends face3, 2, 6, 7, -1,7, 6, 5, 4, -1,4, 5, 1, 0, -1,0, 3, 7, 4, -1,1, 5, 6, 2, -1 ]

} # IndexedFaceSet} # Separator

Page 51: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 51

Specifying Face Normals, Colors# primarycube.iv

Separator {# cube verticesCoordinate3 {

point [….. ] } #coordinate3 # face normals, per-faceNormal {

vector [-1 0 0, 1 0 0, 0 -1 0,0 1 0, 0 0 -1, 0 0 1, ]

} # Normal# assign normals per faceNormalBinding { value PER_PART }# face colors, per-faceBaseColor { # set diffuse colors

rgb [ 1 0 0, # 0, red0 1 0, # 1, green0 0 1, # 2, blue0 1 1, # 3, ~red1 0 1, # 4, ~green1 1 0, ]# 5, ~blue

} # BaseColor# assign color ids per face

MaterialBinding { value PER_FACE_INDEXED }IndexedFaceSet {

coordIndex [ # define faces with vertex ids4, 5, 1, 0, -1, 3, 2, 6, 7, -1, # -x, +x1, 5, 6, 2, -1, 0, 3, 7, 4, -1, # -y +y7, 6, 5, 4, -1, 0, 1, 2, 3, -1,]# -z +z

materialIndex [ # material ids per face3, 0, 4, 1, 5, 2, -1 ]

} # IndexedFaceSet

} # Separator

Page 52: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 52

Normals, Colors Per Vertex

...MaterialBinding { value PER_VERTEX_INDEXED }...materialIndex [ # color ids; per face, then per

vertex0, 1, 2, 3, -1, # -x0, 1, 2, 3, -1, # +x0, 1, 2, 3, -1, # -y0, 1, 2, 3, -1, # +y0, 1, 2, 3, -1, # -z0, 1, 2, 3, -1 # +z]

Page 53: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 53

Questions?

Page 54: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 54

Today: Inventor modeling

• A simple modeling example

• Inventor tools

• Inventor representation

• More complex objects

Page 55: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 55

File Inclusion

#Inventor V2.1 ascii# file cubesphere.iv, a cube and sphere.Switch {

DEF mycube Separator { Cube { height 4 } }

DEF mysphere Separator { Sphere { radius 2. } }}# top-level Separator is optionalUSE mycubeUSE mysphere# end of cubesphere.iv

Page 56: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 56

File Inclusion & Instancing#Inventor V2.1 ascii

# instance 2 cubespheres.Switch {

DEF cubesphere # call it what you wishFile { name "cubesphere.iv" }

}Separator {

Translation { translation 2 0 0 }Scale { scaleFactor 2 2 1 }USE cubesphere

}Separator {

Translation { translation -2 0 0 }Scale { scaleFactor 1 1 2 }USE cubesphere

}

Page 57: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 57

Hierarchical Instancing#Inventor V2.1 ascii

File { name "coordaxes.iv" }Switch { DEF fourcubes Separator {

Separator {Translation { translation -1 -1 -1 }Scale { scaleFactor 0.5 0.5 0.5 }Cube {}

} # Separator...Separator {

Translation { translation 1 -1 -1 }Scale { scaleFactor 0.5 0.5 0.5 }Cube {}

} # Separator} }USE fourcubesTranslation { translation 0 0 2 }USE fourcubes

Page 58: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 58

Hierarchical Instancing

#Inventor V2.1 asciiSwitch {DEF eightcubes

File { name "eightcubes.iv" }}Switch { DEF fourgroups Separator {

Separator {Translation { translation -1 -1 -1 }Scale { scaleFactor 0.5 0.5 0.5 }USE eightcubes

} # Separator...Separator {

Translation { translation 1 -1 -1 }Scale { scaleFactor 0.5 0.5 0.5 }USE eightcubes } # Separator

} }USE fourgroupsTranslation { translation 0 0 2 }USE fourgroups

Page 59: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 59

Modeling Complex Structures

• Use simple hierarchy when:– natural “ownership" relation exists– repetitive structure occurs– simple shapes reoccur

• Some entities require generalized hierarchy– graphs, networks, etc.

• Some entities have no hierarchical structure– induce one with spatial data structures

Page 60: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 60

Smooth Surfaces with Polygons• Example: Sphere, using Spherical

Coordinates

Page 61: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 61

Example: Faceted Sphere• Method 1: Explicit Parametrization

• What range should , take for sphere?– Advantages? Disadvantages?

Page 62: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 62

Projective Methods

• Start with a regular polyhedron, with cospherical vertices (by definition)

• Subdivide each (planar) face• Project new vertices onto sphere• Recurse

Page 63: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 63

Subdivision

• Center-based, edge-based

Page 64: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 64

Projection• Sphere equation (implicit):

x2 + y2 + z2 = r2

• Ray from origin to vertex vx; vy; vz (explicit):

– (0; 0; 0) + t(vx; vy; vz)

• Plug in: t2 (vx

2 + vy2 + vz

2) = r2

• Solve for t, plug in to explicit expression

Page 65: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 65

Recursion

• How many triangles after n recursion steps?(consider initial tetrahedron as n = 1)

• Does this scheme exhibit any degeneracies?

• What is surface normal at projected vertex (vx; vy; vz)

Page 66: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 66

Regular polyhedra

• Tetrahedron• Cube • Octahedron • Dodecahedron • Icosahedron • Models courtesy of

– The Encyclopedia of Polyhedra By George W. Hart

– http://www.georgehart.com/virtual-polyhedra/vp.html

Page 67: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 67

Quadrics• Implicit surfaces of form

• Or, can be expressed asAx2 + 2Bxy + 2Cxz + 2Dx + Ey2

+2Fyz + 2Gy + Hz2 + 2Iz + J = 0• Quadrica Page

– http://www3.kawase-h.ed.jp/Teachers/~Takahashi/Quadrica.html

• http://amath.colorado.edu/appm/staff/fast/java/qg.html

1

)1(z

y

x

PONM

LKJI

HGFE

DCBA

zyx

Page 68: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 68

Parametrizing Complex Objects

• Example: Torus ???

Page 69: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 69

Free-Form Surfaces: Bézier PatchesSeparator {

Coordinate3 {point [ -1.5 -1.5 0, -0.5 -1.5 0, ...

0.5 1.5 0, 0.5 1.5 0, ]} # Coordinate3IndexedNurbsSurface {

numUControlPoints 4numVControlPoints 4uKnotVector [ 0, 0, 0, 0, 1, 1, 1, 1 ]vKnotVector [ 0, 0, 0, 0, 1, 1, 1, 1 ]coordIndex [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,

10, 11, 12, 13, 14, 15 ]} # IndexedNurbsSurface

}

Page 70: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 70

Fractals: Self-similar objects

• Recursive construction rules yield regular fractals– von Koch snowflake

– Sub-objects need not be connected:

– Three-D construction rules abound:

Page 71: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 71

Fractal Objects

• Sierpinski's gadget (area, volume in limit?)

• (Credit: Unreal image, rendered on Amiga)

• Other versions possible

Page 72: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 72

Terrain: irregular fractal generation• Usually height fields, i.e., z = f(x; y)

• Displacements can be random– Subdivision and displacement

• Can also use randomness for (e.g.)– geometric perturbations– parameter settings– material properties

Page 73: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 73

Assignment 1 Object Modeling• At least four “things going on" today:

– Defining a single object in Inventor (.iv files)– Viewing such objects with Inventor viewing tools– Inventor's internal representation for SceneGraphs– Writing a C program to output one such le

• Parametrize the program to output one object for each conguration of command-line parameters

• Only the first and last are part of Assignment 1 !• We provide the “template" program uid_object.c

– generalized command-line handling– valid Inventor le (by default)– embedded informational comments

• NOT graded on artistic talent

Page 74: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 74

Parametric Modeling• You should support at least four parameter

types:– Existence - a binary attribute– Continuous - some arbitrary-valued attribute– Discrete - some integer-valued attribute– Material - a modifier for the surface properties

• Extensions:– Animation (Rotor, Shuttle, Engines, etc.)– Constraint: object must render at 5 Hz on a PC

(can use ivview -q to optimize)

Page 75: MIT EECS 6.837, Teller and Durand 1 Inventor modeling and Scene Graph MIT EECS 6.837 Frédo Durand and Seth Teller

MIT EECS 6.837, Teller and Durand 75

Next Time

• Rendering Pipeline