Download presentation

Presentation is loading. Please wait.

Published byCade Farleigh Modified over 2 years ago

1
Hierarchical Transformation

2
Summary Alternatively, OpenGL thinks: A transformation updates the coordinate system. For each change, the transformation is defined in the current (local) coordinate system. Transformation matrix and coordinate system are equivalent. The code is in the forward order! If we think: Each transformation updates the vertex in an absolute world. Then, the code is arranged in a reverse order.

3
A hierarchy W glLoadIdentity(); //A dot at 0,0,0 W

4
A hierarchy W L1 glLoadIdentity(); //A dot at 0,0,0 glTranslatef(2,0,0); //A dot at 0,0,0 L1 W

5
A hierarchy W L1 L2 glLoadIdentity(); //A dot at 0,0,0 glTranslatef(2,0,0); //A dot at 0,0,0 glTranslatef(1,1,0); glRotatef(45,0,0,1); //A dot at 0,0,0 L1 L2 W

6
A hierarchy L1 L2 W L3 W L1 L2 glLoadIdentity(); //A dot at 0,0,0 glTranslatef(2,0,0); //A dot at 0,0,0 glTranslatef(1,1,0); glRotatef(45,0,0,1); //A dot at 0,0,0 glTranslatef(1,1,0); glRotate(45,0,0,1); //A dot at 0,0,0 L3

7
A hierarchy glLoadIdentity(); //A dot at 0,0,0 glTranslatef(2,0,0); //A dot at 0,0,0 glTranslatef(1.41,0,0); glRotatef(90,0,0,1); //A dot at 0,0,0 glTranslatef(1,1,0); glRotate(45,0,0,1); //A dot at 0,0,0 L1 L2 W L3 Unchanged W L1 L2 L3

8
A hierarchy L1W L4 L2 L3 W L1 L2 L3 L4 Draw in W W->L1; Draw in L1 L1->L2; Draw in L2 L2->L3; Draw in L3 L3->L2; L2->L4; Draw in L4

9
A hierarchy L1W L4 L2 L3 W L1 L2 L3 L4 Draw in W W->L1; Draw in L1 L1->L2; Draw in L2 L2->L3; Draw in L3 L3->L2; L2->L4; Draw in L4 L4->L2 L2->L1 L1->L5; Draw in L5 L5

10
Summary W L1 L2 L3 L4 L5 The skeleton model can be defined as a tree. Rendering can be done by depth-first transversal. Matrix and coordinate system has the same idea: the matrix gives You can use inverse transformation (not a good way) to rewind: such as L3->L2, L2->L1…

11
2 1 Matrix Stack //Transformation+Draw glPushMatrix(); //Transformation+Draw glPushMatrix(); //Transformation+Draw glPopMatrix(); //Transformation+Draw glPushMatrix(); //Transformation+Draw glPopMatrix(); //Transformation+Draw glPopMatrix(); Matrix 1 Matrix 2 Matrix 3 Matrix 1 1 1 31 1

12
Matrix Stack W L1 L2 L3 L4 L5 //Starts with W //Do W->L1 glPushMatrix(); //Back up L1 //Do L1->L2 glPushMatrix(); //Back up L2 //Do L2->L3 glPopMatrix(); //Restore L2 //Do L2->L4 glPopMatrix(); //Restore L1 //Do L1->L5 //Done Instead of doing inverse transformation, we can easily rewind using the matrix stack. Depth-First Traversal

13
The Human Body Hip AbdomenlButtockrButtock Chest NecklCollarrCollar lShoulder lForeArm lHand HeadrShoulder rForeArm rHand lThigh lShin lFoot lToe End rThigh rShin rFoot rToe End

14
Motion Capture

15
Performance Capture

16
BVH The Biovision Hierarchy (BVH) file format was developed by Biovision, a defunct motion capture company. It stores motion capture data. It’s a text file. It matches with OpenGL well. (That is why you will learn how to use it in Lab2.) It has two parts: hierarchy and data.

17
Part 1: Hierarchy The hierarchy is a joint tree. Each joint has an offset and a channel list. Offset is a bone vector (defined in L1) from Joint 1 to Joint 2. Let L12 be a shifted L1 at Joint 2. The channel list defines a sequence of transformations from L12 to L2. L1 L2 Joint 1 Joint 2 L12

18
Part 1: Hierarchy The channel list uses nine deformations: Xposition, Yposition, Zposition Xrotation, Yrotation, Zrotation Xscale, Yscale, Zscale The list only tells us transformation types and their orders. The order is the same as in OpenGL. To know the actual transformation, we need to read the data. L1 L2 Joint 1 Joint 2 L12

19
An example Chest Joint and its local coordinate system Neck Joint and its local coordinate system Neck’s offset from chest (like a bone) Channel list: Transformation from chest coordinate system to neck coordinate system

20
Variable 1Variable 2Variable 3 Variable 4Variable 5Variable 6 Variable 7Variable 8Variable 9 The data part stores a number of frames. Each frame is a list of variables. The model is animated, when each frame uses variables. Part 2: Data

21
How to use BVH.h class BVH { public: BVH_NODE root; … void Read_File(…); void Set_Data(frame_id); void Forward(); void Backward(); void Render(); } BVH.h does most things for you. Your job is to complete the render function. class BVH_NODE { public: char name[1024]; float offset[3]; BVH_NODE* children; int children_number; float *tx, *ty, *tz; float *rx, *ry, *rz; float *sx, *sy, *sz; int data_order[9]; }

22
The Data Order In data_order: 1 means tx; 2 means ty; 3 means tz 4 means rx; 5 means ry; 6 means rz 7 means sx; 8 means sy; 9 means sz 0 means end 3 3 2 2 7 7 9 9 5 5 0 0 Translate *tz Translate *ty Scale *sx Scale *sz Rotate *ry end

23
The Camera View To change the camera view We can update the gluLookAt function (which is not very easy…). Or, we can combine gluLookAt with transformation functions. (Check Lab2 for details.) gluLookAt(eye_x, eye_y, eye_z, center_x, center_y, center_z, up_x, up_y, up_z)

Similar presentations

Presentation is loading. Please wait....

OK

COMP 175: Computer Graphics March 10, 2015

COMP 175: Computer Graphics March 10, 2015

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on 4 p's of marketing mix Ppt on telephone etiquettes Ppt on digital multimedia broadcasting Download ppt on railway reservation system Ppt on jindal steels Ppt on file system in unix grep Ppt on ways to improve communication skills Ppt on class ab power amplifier Ppt on high voltage engineering applications Ppt on amplitude shift keying remote