Introduction to Computer GraphicsFarhana Bandukwala, PhDLecture 18: Scene Graphs & Trees in OpenGLOutline• Hierarchical Objects• Scene graphs• TreesHierarchical Objects• Consider a robot• Composed of head, torso, arms and legs• Still further break down– arms: upper & lower & hands– Legs: upper & lower & feetDescribe attributes• Head, hands, feet might have material property alike skin• Upper & lower arms and legs, torso may have material alike clothingYX ZDescribe valid motion:• Head rotates around y• Upper arm rotates around shoulder -> elbow translates• Lower arm rotates around elbow -> hand translates• Upper leg rotates at hip -> knee translates• Lower leg rotates at knee -> foot translatesYX ZRepresent Part motion hierarchically• Shoulder position (or top of upper arm) w/ respect to torso • Elbow position (or bottom of upper arm) w/respect to shoulder & rotation• Hand (or lower arm bottom) w/respect to elbow & rotationYX ZScene graphs• Data structure to represent hierarchical nature of object or scene• Allows an explicit representation of where to place separators• In OpenGL this means where to place glPushMatrix()/glPopMatrix() or glPushAttrib()/glPopAttrib()Robot Body (Torso)HeadArm 1 Arm 2 Leg 1 Leg 2Upper Lower Upper LowerNode propertiesRobot Body (Torso)HeadArm 1 Arm 2 Leg 1Leg 2Upper Lower Upper LowerMaterial properties Material properties,TranslateRotateMaterial properties,TranslateShoulder pos, elbow posMaterial properties,TranslateHip posKnee
View Full Document