1 / 27

Instance Transformation

y. y. y. y. x. x. x. x. z. z. z. z. Instance Transformation. S. R. T. Model Coordinates. Instancing in OpenGL. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(...); glRotate(...); glScale(...); glutSolidCylinder(...); /*or some other symbol*/. Symbol. Scale.

dani
Download Presentation

Instance Transformation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. y y y y x x x x z z z z Instance Transformation S R T Model Coordinates

  2. Instancing in OpenGL glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(...); glRotate(...); glScale(...); glutSolidCylinder(...); /*or some other symbol*/ Symbol Scale Rotate Translate Cylinder sx, sy, sz qx, qy, qz dx,dy,dz Cylinder . . . Sphere Tabular Representation

  3. Example of a Linked Structure: Robot Arm y y y y f x x x q z z z

  4. Moving Robot Components and Frames h2 h1

  5. Robot Construction display() { glRotate(theta, 0.0, 1.0, 0.0); base(); glTranslatef(0.0, h1, 0.0); glRotatef(phi, 0.0, 0.0, 1.0); lower_arm(); glTranslatef(0.0, h2, 0.0); glRotatef(psi, 0.0, 0.0, 1.0); upper_arm(); }

  6. Transform * Draw Func. * Child(ren) Hierarchical Structure display() { glRotate(theta, 0.0, 1.0, 0.0); base(); glTranslatef(0.0, h1, 0.0); glRotatef(phi, 0.0, 0.0, 1.0); lower_arm(); glTranslatef(0.0, h2, 0.0); glRotatef(psi, 0.0, 0.0, 1.0); upper_arm(); } Base Lower Arm Upper Arm

  7. Torso Left Upper Arm Right Upper Arm Right Upper Leg Left Upper Leg Head Left Lower Arm Right Lower Arm Right Lower Leg Left Lower Leg Tree Representation of More Complex Robot

  8. Torso Th Tlua Trua Tlul Trul Left Upper Arm Right Upper Arm Right Upper Leg Left Upper Leg Head Tlla Trla Tlll Trll Left Lower Arm Right Lower Arm Right Lower Leg Left Lower Leg Tree with Transformations

  9. Torso Th Tlua Trua Tlul Trul Left Upper Arm Right Upper Arm Right Upper Leg Left Upper Leg Head Tlla Trla Tlll Trll Left Lower Arm Right Lower Arm Right Lower Leg Left Lower Leg Traversing the Tree Current Transform. figure() { Torso(); glPushMatrix(); glTranslatef(...); glRotatef(...); Head(); glPopMatrix(...); glPushMatrix(...); glTranslatef(...); glRotatef(...); LeftUpperArm(); glTranslatef(...); glRotatef(...); LeftLowerArm(); glPopMatrix(...); glPushMatrix(...); glTranslatef(...); glRotatef(...); RightUpperArm(); glTranslatef(...); glRotatef(...); RightLowerArm(); T T•Th T T•Tua T•Tua•Tlla T T•Trua T•Trua•Trla

  10. Scene Translate Object 1 Translate Object 4 Translate Rotate Rotate Object 2 Object 3 Scene Graphs

  11. Scene GraphsTraversing the Graph glPushMatrix(); glTranslate(...); glRotate(..._; Object1(); glPopMatrix(); glPushMatrix(); glTranslate(...); Object2(); glPopMatrix(); glPushMatrix(); glTranslate(...); glRotate(...); Object3(); glPopMatrix(); glPush Matrix(); Object4();

  12. TCP/IP Architecture for Graphics on the Internet UI Graphics Pipeline Model Application API Display Browser Browser Model UI UI Graphics Pipeline Graphics Pipeline Display Server Display TCP/IP TCP/IP Network/Internet

  13. VRML Design Goals • Composability • Scalability • Extensibility • Simple authoring

  14. VRML 2.0 Scene Graph Structure Nodes Group Transformation Shape

  15. VRML 2.0Node Format Node_Name { field_name field_value field_name field_value . . . field_name field_value } Each field has an associated class and type. Field class is one of: field, exposedfield, eventIn, enventOut

  16. VRML 2.0Field Types SFBool The Boolean value TRUE or FALSE SFFloat A 32-bit floating point value SFInt32 A 32-bit signed integer SFTime An absolute or relative time value SFVec2f A pair of floating point values, usually used to represent texture coordinates SFVec3f Three floating point values, usually used to represent a 3D position SFColor Three floating point values between zero and one, used to represent RGB SFRotation Four floating point values. The first three represent an axis, the fourth an angle

  17. VRML 2.0Field Types SFImage A two-dimensional image with one to four color components SFString A UTF8 (international character) string SFNode A container for another VRML node MFFloat An array of SFFloat values MFInt32 An array of SFInt32 values MFVec2f An array of SFVec2f values MFVec3f An array of SFVec3f values MFColor An array of SFColor values MFRotation An array of SFRotation values MFString An array of SFString values

  18. VRML 2.0Composing Node Hierarchies Node_name_1 { field_name field_value field_name Node_name_2 { field_name field_value field_name field_value } field_name Node_name_3 { field_name field_value field_name field_value } } 1 2 3

  19. VRML 2.0The Shape Node Definition Field Name Node Name Shape { exposedField SFNode appearance NULL exposedField SFNode geometry NULL } Field Class Field Type Default Value Bold values are what is actually typed in source file.

  20. VRML 2.0Geometry Nodes • Predefined shapes • Cone • Box • Cylinder • Sphere • PointSet • IndexedLineSet (polyline) • IndexedFaceSet (polygonal object) • ElevationGrid • Extrusion • Text

  21. VRML 2.0Cone Definition Cone { field SFFloat bottomRadius 1 field SFFloat height 2 field SfBool side TRUE field SFBool bottom TRUE } The Cone node specifies a cone centered in the local coordinate system and whose axis is aligned with the local y axis. The Boolean fields define whether the sides or bottom of the cone are visible. All dimensions are in meters.

  22. VRML 2.0Box Definition Box { field SFVec3f size 2 2 2 } The Box node specifies a rectangular box in the local coordinate system centered at 0,0,0 and aligned with coordinate axes.

  23. VRML 2.0Cylinder Definition Cylinder { field SFBool bottom TRUE field SFFloat height 2 field SFFloat radius 1 field SFBool side TRUE field SFBool top TRUE } Sphere Definition Sphere { field SFFloat radius 1 }

  24. VRML 2.0Indexed Face Set - Partial Definition IndexedFaceSet { exposedField SFNode coord NULL field SFBool ccw TRUE field SFBool convex TRUE field MFInt32 coordIndex [] field SFBool solid TRUE ... } Coordinate { exposedField MFVec3f point [] } There are 13 other fields in IndexedFaceSet, making it the most complex and flexible node in VRML.

  25. VRML 2.0Simplest Possible World Geometry Field Shape Node Shape{ geometry Cone { } } Cone node has no fields: accept all default values. Shape node has no appearance field: accept all white.

  26. VRML 2.0Appearance & Material Nodes Appearance { exposedField SFNode material NULL exposedField SFNode texture NULL exposedField SFNode textureTransform NULL } Material { exposedField SFFloat ambientIntensity 0.2 exposedField SFColor diffuseColor 0.8 0.8 0.8 exposedField SFColor emissiveColor 0 0 0 exposedField SFFloat shininess 0.2 exposedField SFColor specularColor 0 0 0 exposedField SFFloat transparency 0 }

  27. VRML 2.0Transform Node Definition Transform { enventIn MFNode addChildren eventIn MFNode removeChildren exposedField SFVec3f center 0 0 0 exposedField MFNode children [] exposedField SFRotation rotation 0 0 1 0 exposedField SFVec3f scale 1 1 1 exposedField SFRotation scaleOrientation 0 0 1 0 exposedField SFVec3f translation 0 0 0 field SFVec3f bboxCenter 0 0 0 field SFVec3f bboxSize -1 -1 -1 } Order of application: T(translation) • T(rotation) • T(scale) {children}

More Related