Inventor modeling and Scene Graph MIT EECS 6
- Slides: 75
Inventor modeling and Scene Graph MIT EECS 6. 837 Frédo Durand Seth Teller MIT EECS 6. 837, Teller and Durand 1
Calendar • Assignment 1: Due Friday 20 at 5 pm • Final projects will be due December 4 • Defense and presentation until December 10 • Dates can vary +/- 2 days MIT EECS 6. 837, Teller and Durand 2
Hierarchical models MIT EECS 6. 837, Teller and Durand 3
Hierarchical models MIT EECS 6. 837, Teller and Durand 4
Hierarchical models MIT EECS 6. 837, Teller and Durand 5
Hierarchical models MIT EECS 6. 837, Teller and Durand 6
Hierarchical models MIT EECS 6. 837, Teller and Durand 7
Hierarchical models MIT EECS 6. 837, Teller and Durand 8
Hierarchical models MIT EECS 6. 837, Teller and Durand 9
Overview of Inventor • A suite of tools – Viewer(s) – Utilities • An API – C++ set of classes for 3 D display and manipulation • File format – ASCII or binary – Later became VRML • Virtual Reality Modeling Language • Internet 3 D format MIT EECS 6. 837, Teller and Durand 10
Demo • View models • Show application developed under inventor • Look at. iv file MIT EECS 6. 837, Teller and Durand 11
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 MIT EECS 6. 837, Teller and Durand 12
Questions? MIT EECS 6. 837, Teller and Durand 13
Today: Inventor modeling • A simple modeling example • Inventor tools • Inventor representation • More complex objects MIT EECS 6. 837, Teller and Durand 14
Object and World Space Modeling • Object space a sort of “workbench" where components are assembled, combined • World space is a “canvas" on/in which finished objects are placed • But: often useful to view both ways • Usually, required transformations, ordering obvious • Example: Boat, sub, articulated grasper arm, treasure MIT EECS 6. 837, Teller and Durand 15
Simple modeling • Model a boat with an articulated grasp arm MIT EECS 6. 837, Teller and Durand 16
Simple bottom-up modeling • Model a boat with an articulated grasp arm MIT EECS 6. 837, Teller and Durand 17
Modeling the boat # boat, version 1 Switch { DEF boat Separator { Material { diffuse. Color 1 0 0 } # RGB (red) Coordinate 3 { point [ 0 0 0, 5 0 0, 7 2 0, 4 1. 5 0, 1. 5 2 0, 0 2 0] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 2, 3, 4, 5, 6, 7, -1 ] } } } # Switch MIT EECS 6. 837, Teller and Durand 18
Modeling the robot arm # grasper Switch { DEF grasper Separator { Material { diffuse. Color 0 1 1 } Coordinate 3 { point [ -2 -1 0, -0. 5 -1 0, 2 -1 0, 1. 5 3 0, 1 1 0, 0. 5 1 0, -1 3 0, -1. 5 3 0 ] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 8, 9, 10, 11, -1, 2, 3, 4, 5, 6, 7, -1 ] } } } # Switch MIT EECS 6. 837, Teller and Durand 19
Exploit symmetry # grasper alternative Switch { DEF grasper Separator { Material { diffuse. Color 0 1 1 } Coordinate 3 { point [ -2 -1 0, -0. 5 1 0, -1 3 0, -1. 5 3 0 ] } # Coordinate 3 Face. Set { num. Vertices [ 6 ] } Scale { scale. Factor -1 1 1 } # why ? Face. Set { num. Vertices [ 6 ] } } } # Switch MIT EECS 6. 837, Teller and Durand 20
Forearm (with use of grasper) # forearm Switch { DEF forearm Separator { Material { diffuse. Color 1 0 1 } # magenta Coordinate 3 { point [ 0 -0. 5 0, 4 0. 5 0, 0 0. 5 0 ] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 2, 3, -1 ] } # instance grasper Translation { translation 3. 5 0 0 } Rotation. XYZ { axis Z angle -1 } USE grasper } } # Switch MIT EECS 6. 837, Teller and Durand 21
Arm (uses forearm that uses grasper) # arm Switch { DEF arm Separator { Material { diffuse. Color 1 0. 5 0 } Coordinate 3 { point [ 0 -0. 5 0, 4 0. 5 0, 0 0. 5 0 ] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 2, 3, -1 ] } # instance forearm Translation { translation 3. 5 0 0 } Scale { scale. Factor 0. 5 0 } Rotation. XYZ { axis Z angle -0. 25 } # joint angle wrt. mount USE forearm } } # Switch MIT EECS 6. 837, Teller and Durand 22
Robot (uses…) # robot Switch { DEF robot Separator { Material { diffuse. Color 0 1 0 } Coordinate 3 { point [ 0 0 0, 2 0 0, 3 1 0, 2 2 0, 0 2 0 ] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 2, 3, 4, -1 ] } # instance entire arm Translation { translation 2 1 0 } Scale { scale. Factor 0. 5 0 } Rotation. XYZ { axis Z angle 0. 5 } # joint angle wrt. mount USE arm } } # Switch MIT EECS 6. 837, Teller and Durand 23
Placing robot on boat # boat, version 2 Switch { DEF boat Separator { Material { diffuse. Color 1 0 0 } Coordinate 3 {point [ 0 0 0, 5 0 0, 7 2 0, 4 1. 5 0, 1. 5 2 0, 0 2 0] } # Coordinate 3 Indexed. Face. Set { coord. Index [ 0, 1, 2, 3, 4, 5, 6, 7, -1 ] } # instance robot wrt boat Translation { translation 5 2 0 } # on board (up) Scale { scale. Factor 0. 5 0 } USE robot } } # Switch MIT EECS 6. 837, Teller and Durand 24
Gold coin # coin Switch { DEF coin Separator { Material { diffuse. Color 0. 8 0. 6 0 } # gold Coordinate 3 { point [ -1 -2 0, 2 -1 0, 2 1 0, 1 2 0, -2 1 0, -2 -1 0 ] } # Coordinate 3 Face. Set { num. Vertices [ 8 ] } } } # Switch MIT EECS 6. 837, Teller and Durand 25
Placing coin and robot in the ocean # boat, version 3 Switch { DEF boat Separator {. . . # instance robot sub wrt boat Translation { translation 1. 5 -4 0 } # diving Scale { scale. Factor 0. 5 0 } USE robot } } # Switch # place boat on sea surface Separator { Translation { translation -8 -0. 5 0 } Scale { scale. Factor 2. 5 0 } USE boat } # place coin on sea bottom Separator { Translation { translation 3 -10 0 } Scale { scale. Factor 0. 25 0 } USE coin } MIT EECS 6. 837, Teller and Durand 26
How to grasp the coin? MIT EECS 6. 837, Teller and Durand 27
Questions? MIT EECS 6. 837, Teller and Durand 28
Today: Inventor modeling • A simple modeling example • Inventor tools • Inventor representation • More complex objects MIT EECS 6. 837, Teller and Durand 29
Inventor tools • Scene. Viewer MIT EECS 6. 837, Teller and Durand 30
Interaction • • • Interaction Modes & Icons Default: 3 D Viewer (hand icon) Trackball, Walk, Fly, Plane view Also Select, Help, Home, Set Home, Center, Set Center, Ortho/Perspective MIT EECS 6. 837, Teller and Durand 31
Selection MIT EECS 6. 837, Teller and Durand 32
Manipulators • Trackball • Tab Box • Jack MIT EECS 6. 837, Teller and Durand 33
Light Creation/Editing • Point, Directional, Spot MIT EECS 6. 837, Teller and Durand 34
Material / Color Editing • Editors – Material, Color • Enabled only when some entity is selected MIT EECS 6. 837, Teller and Durand 35
Questions? MIT EECS 6. 837, Teller and Durand 36
Today: Inventor modeling • A simple modeling example • Inventor tools • Inventor representation • More complex objects MIT EECS 6. 837, Teller and Durand 37
Inventor Representations • Basic idea: Tree • Comprised of several node types: – Shape: 3 D geometric objects – Transform: Affect current transformation – Property: Appearance, texture, etc. – Group: Collection of subgraphs MIT EECS 6. 837, Teller and Durand 38
Inventor Representations • • In fact, Scene graph Directed Acyclic Graph (DAG) Allows multiple instantiations Cycle forbidden – because infinite recursions MIT EECS 6. 837, Teller and Durand 39
Traversal • Breadth first – Top to bottom, left to right MIT EECS 6. 837, Teller and Durand 40
Traversal State • The State is updated during traversal – Transformations, properties – Influence of nodes can be complex – E. g. bottom to top MIT EECS 6. 837, Teller and Durand 41
Built-In Geometric Primitives • Trivial example: #Inventor V 2. 1 ascii Cube {} Primitive attributes: Default W, H, D (for cubes, spheres, cones, etc. ); Default Color; Material; etc Traversal state (all defaulted for now): Transform; Lights; Material; etc. MIT EECS 6. 837, Teller and Durand 42
Definition & Instantiation Switch { DEF unitcube Cube {} } # Switch Separator { Scale { scale. Factor 1 1 2 } USE unitcube } # Separator MIT EECS 6. 837, Teller and Durand 43
Useful scene graph: Axes Separator { Translation { translation 2 0 0 } Scale { scale. Factor 4. 0 0. 25 } Material { diffuse. Color 1 0 0 } Cube {} } # Separator {. . . Material { diffuse. Color 0 1 0 } Cube {} } # Separator. . . Separator {. . . Sphere {} } # Separator MIT EECS 6. 837, Teller and Durand 44
Persistence of Traversal State # place two boats on surface (surprising result ? ) Separator { Translation { translation -8 3 0 } USE boat Translation { translation 2 3 0 } USE boat } MIT EECS 6. 837, Teller and Durand 45
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 MIT EECS 6. 837, Teller and Durand 46
Composing Transformations. . . Separator { Rotation { rotation 0 0 1 0. 5 } # axis, angle Translation { translation 3 0 0 } USE boat } # Separator . . . Separator { Translation{ translation 3 0 0 } Rotation { rotation 0 0 1 0. 5 } # axis, angle USE boat } # Separator MIT EECS 6. 837, Teller and Durand 47
Material Properties To color with “intrinsic material“ (constant color): . . . Light. Model { model BASE_COLOR } File { name "coordaxes. iv" } Separator { Material { diffuse. Color 0. 8 0. 0 } Sphere {} } # Separator MIT EECS 6. 837, Teller and Durand 48
Using a Lighting Model To shade with “lighting model": . . . Light. Model { model PHONG } Directional. Light { intensity 1 color 1 1 1 direction -1 -1 -1 # "shining" this dir } Separator { Material { diffuse. Color 0. 25 specular. Color 0. 8 shininess 0. 9 } # Material Sphere {} } # Separator MIT EECS 6. 837, Teller and Durand 49
Polyhedral Objects Separator { Coordinate 3 { point [ -1 1 1, -1 -1 1, 1 1 1, -1 1 -1, -1 -1 -1, 1 1 -1 ] } # Coordinate 3 Indexed. Face. Set { # multiple faces coord. Index [ 0, 1, 2, 3, -1, # vertex ids, -1 ends face 3, 2, 6, 7, -1, 7, 6, 5, 4, -1, 4, 5, 1, 0, -1, 0, 3, 7, 4, -1, 1, 5, 6, 2, -1 ] } # Indexed. Face. Set } # Separator MIT EECS 6. 837, Teller and Durand 50
Specifying Face Normals, Colors # primarycube. iv Separator { # cube vertices Coordinate 3 { point […. . ] } #coordinate 3 # face normals, per-face Normal { vector [-1 0 0, 0 -1 0, 0 0 -1, 0 0 1, ] } # Normal # assign normals per face Normal. Binding { value PER_PART } # face colors, per-face Base. Color { # set diffuse colors rgb [ 1 0 0, # 0, red 0 1 0, # 1, green 0 0 1, # 2, blue 0 MIT 1 EECS 1, # 6. 837, 3, ~red Teller and Durand 51
Normals, Colors Per Vertex. . . Material. Binding { value PER_VERTEX_INDEXED }. . . material. Index [ # color ids; per face, then per vertex 0, 1, 2, 3, -1, # -x 0, 1, 2, 3, -1, # +x 0, 1, 2, 3, -1, # -y 0, 1, 2, 3, -1, # +y 0, 1, 2, 3, -1, # -z 0, 1, 2, 3, -1 # +z ] MIT EECS 6. 837, Teller and Durand 52
Questions? MIT EECS 6. 837, Teller and Durand 53
Today: Inventor modeling • A simple modeling example • Inventor tools • Inventor representation • More complex objects MIT EECS 6. 837, Teller and Durand 54
File Inclusion #Inventor V 2. 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 optional USE mycube USE mysphere # end of cubesphere. iv MIT EECS 6. 837, Teller and Durand 55
File Inclusion & Instancing #Inventor V 2. 1 ascii # instance 2 cubespheres. Switch { DEF cubesphere # call it what you wish File { name "cubesphere. iv" } } Separator { Translation { translation 2 0 0 } Scale { scale. Factor 2 2 1 } USE cubesphere } Separator { Translation { translation -2 0 0 } Scale { scale. Factor 1 1 2 } USE cubesphere } MIT EECS 6. 837, Teller and Durand 56
Hierarchical Instancing #Inventor V 2. 1 ascii File { name "coordaxes. iv" } Switch { DEF fourcubes Separator { Translation { translation -1 -1 -1 } Scale { scale. Factor 0. 5 } Cube {} } # Separator. . . Separator { Translation { translation 1 -1 -1 } Scale { scale. Factor 0. 5 } Cube {} } # Separator }} USE fourcubes Translation { translation 0 0 2 } USE fourcubes MIT EECS 6. 837, Teller and Durand 57
Hierarchical Instancing #Inventor V 2. 1 ascii Switch {DEF eightcubes File { name "eightcubes. iv" }} Switch { DEF fourgroups Separator { Translation { translation -1 -1 -1 } Scale { scale. Factor 0. 5 } USE eightcubes } # Separator. . . Separator { Translation { translation 1 -1 -1 } Scale { scale. Factor 0. 5 } USE eightcubes } # Separator }} USE fourgroups Translation { translation 0 0 2 } USE fourgroups MIT EECS 6. 837, Teller and Durand 58
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 MIT EECS 6. 837, Teller and Durand 59
Smooth Surfaces with Polygons • Example: Sphere, using Spherical Coordinates MIT EECS 6. 837, Teller and Durand 60
Example: Faceted Sphere • Method 1: Explicit Parametrization • What range should , q, j take for sphere? – Advantages? Disadvantages? MIT EECS 6. 837, Teller and Durand 61
Projective Methods • Start with a regular polyhedron, with cospherical vertices (by definition) • Subdivide each (planar) face • Project new vertices onto sphere • Recurse MIT EECS 6. 837, Teller and Durand 62
Subdivision • Center-based, edge-based MIT EECS 6. 837, Teller and Durand 63
Projection • Sphere equation (implicit): x 2 + y 2 + z 2 = r 2 • Ray from origin to vertex vx; vy; vz (explicit): – (0; 0; 0) + t(vx; vy; vz) • Plug in: t 2 (vx 2 + vy 2 + vz 2) = r 2 • Solve for t, plug in to explicit expression MIT EECS 6. 837, Teller and Durand 64
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) MIT EECS 6. 837, Teller and Durand 65
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 MIT EECS 6. 837, Teller and Durand 66
Quadrics • Implicit surfaces of form • Or, can be expressed as Ax 2 + 2 Bxy + 2 Cxz + 2 Dx + Ey 2 +2 Fyz + 2 Gy + Hz 2 + 2 Iz + J = 0 • Quadrica Page – http: //www 3. kawase-h. ed. jp/Teachers/~Takahashi/Quadrica. html • http: //amath. colorado. edu/appm/staff/fast/java/qg. html MIT EECS 6. 837, Teller and Durand 67
Parametrizing Complex Objects • Example: Torus ? ? ? MIT EECS 6. 837, Teller and Durand 68
Free-Form Surfaces: Bézier Patches Separator { Coordinate 3 { point [ -1. 5 0, -0. 5 -1. 5 0, . . . 0. 5 1. 5 0, ] } # Coordinate 3 Indexed. Nurbs. Surface { num. UControl. Points 4 num. VControl. Points 4 u. Knot. Vector [ 0, 0, 1, 1, 1, 1 ] v. Knot. Vector [ 0, 0, 1, 1, 1, 1 ] coord. Index [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ] } # Indexed. Nurbs. Surface } MIT EECS 6. 837, Teller and Durand 69
Fractals: Self-similar objects • Recursive construction rules yield regular fractals – von Koch snowflake – Sub-objects need not be connected: – Three-D construction rules abound: MIT EECS 6. 837, Teller and Durand 70
Fractal Objects • Sierpinski's gadget (area, volume in limit? ) • (Credit: Unreal image, rendered on Amiga) • Other versions possible MIT EECS 6. 837, Teller and Durand 71
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 MIT EECS 6. 837, Teller and Durand 72
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 Scene. Graphs 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 MIT EECS 6. 837, Teller and Durand 73
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) MIT EECS 6. 837, Teller and Durand 74
Next Time • Rendering Pipeline MIT EECS 6. 837, Teller and Durand 75
- Mit app inventor graph
- Helen erickson biography
- Signal china app
- App inventor
- Mit app inventor emulator
- App inventor location sensor
- Mit app inventor while loop
- Web viewer app inventor 2
- Mit app inventor vs android studio
- Accelerometer sensor mit app inventor
- Mit app inventor run in background
- Zone opasnosti
- Appinventor googlelabs
- App inventor 2 emulator
- 4+9=1
- Push notification app inventor
- Dimensional modeling vs relational modeling
- Mit eecs rqe
- Modeling relational data with graph convolutional networks
- What happens in macbeth act 1 scene 1
- Macbeth act iv summary
- Wait-for graph
- Thomas alva edison was an american inventor and businessman
- Bridge graph
- Dfd chapter 5
- Linear and quadratic functions and modeling
- Dfd chapter 5
- App inventor location sensor
- App inventor java bridge
- Tim bernerslee
- How to think of an invention
- Inventor scripting
- Spirometer
- Cottage industry
- Who invented t test
- Inventor contact types
- App inventorr
- Pressure cooker inventor
- Who invented cctv
- Nitmed tutorials
- Horse drawn hoe
- Curs inventor
- Ccscne
- Who was the inventor of the modern classification system
- Autodesk inventor 2008
- App inventor lego mindstorm ev3
- App inventor vs android studio
- Smallpox vaccine inventor industrial revolution
- John robinson lunch box inventor
- Axle peg inventor train
- Evolution of tqm
- Deming chain reaction
- Jethro tull inventor
- Invention of the hair dryer
- Wattpad inventor
- Chinese rocket
- Derecho otorgado a un inventor crucigrama
- App inventor ocr
- Gustavus swift inventions
- Ozzie williams inventor
- Why did melitta bentz invented the coffee filter
- Properties of breadth first search
- John purdy inventor
- Curs inventor
- Charles drew inventor
- Key players in cruise industry
- Inventor 11
- Inventor
- Inventor
- Florence flask inventor
- Henrique veiga inventor
- Qué otros aportes tuvo el inventor de los logaritmos
- Cb mirick
- Fastag inventor
- Autodesk inventor
- Who invented the snowblower