Download presentation
Presentation is loading. Please wait.
Published byEzra Berry Modified over 8 years ago
1
Rotation about Arbitrary Axis oOften we need rotation about a vector U that is not a coordinate axis (not X, nor Y, nor Z) and may not pass through the coordinate origin oIn this situation we will align U with either X, or Y, or Z, then rotate about this coordinate axis - any transformation to align U will be applied to all objects in the scene oThe translation or the rotations done to align U with the coordinate axis need to be reversed to move U back to its initial position - any transformation to move U back will be applied to all objects in the scene
2
Rotation about an Arbitrary Axis oFirst, translate the vector to coordinate origin: oA rotation about X to bring it to XoZ plane; oA clockwise rotation about Y to align it with Z axis; oNow a rotation about Z is equivalent to rotation about U; oUndo rotations about Y and X.
3
Exercise oA pyramid is defined by five vertices A, B, C, D, and E. The pyramid has to be rotated by 45 degrees about a vector V=(-1,1,0), originating from the point B which is one unit along the positive z-axis. Derive the composite transformation matrix that performs this rotation. Yy X Z V = (-1, 1, 0) C D A B E
5
Today’s Lecture oHierarchical modelling oCreating more complex object/scene oSimple animation oOpenGL transformation matrix stacks oStore transformation matrices being used oPush/pop transformation matrix stack oSave scene state for coming back to later oL-Systems oPixar lamp demo
6
Hierarchical Modeling Scene RobotBall ArmWheelsArm UpperArm LowerArm Hand Finger Wheel
7
Hierarchical Modelling Root node An arc Human body is hierarchical, with body, head, upper arm, lower arm, etc…
8
Data Structure for Hierarchical Modelling oGenerally represented as a tree, with nodes and arcs oA node is a link or a part of the object oAn arc contains transformation to be applied to the node, and the rest of the linkage further down the hierarchy oIt is convenient to define points in the local coordinate system associated with a joint and to have a method for converting the coordinates of a point from one system to another
9
Data Structure for Hierarchical Modelling T0T0 Data for link 0 Data for link 1 Data for link 1.1 T0T0 T 1 transform link1 relative to link0 T 1.1transform link1.1 relative to link1 R1(R1( R 1.1 ( link 0 link 1 link 1.1
10
Kinematics oThe study of object movements irrespective of their speed or style of movement oForward Kinematics oCompute configuration (pose) given individual DoF values oInverse Kinematics oCompute individual DoF values that result in specified end effector position
11
Data Structure for Hierarchical Modelling oSkeletal systems are hierarchical in nature and allow control of the character in an efficient manner oA skeleton consists of rigid links and joints, which can be represented as a tree, and it allows the use of inverse kinematics to animate a character
12
Skeleton Animation oWe create a coordinate frame for the 3D hand, as well as a local frames for skeletons. In a local frame, one axis is the normal of the cross-section plane of the hand surface. The other two axes span the cross-section plane oEach point on the 3D hand model corresponds to a cross-section plane, and therefore a point on a skeleton oWhen the skeleton moves, the local frames on the skeleton are updated and the vertices on the hand model are updated accordingly oMotion capture is the recording of human body movement and mapping it onto the motion of a computer character
13
Animation Techniques oKey framing - the artists draw the major frames of the animation. Major frames are the ones in which prominent changes take place. The animator specifies critical or key positions for the objects. The computer then automatically fills in the missing frames by smoothly interpolating between those positions. oProcedural - the objects are animated by a procedure /a set of rules. The animator specifies rules and initial conditions. oPhysically Based - this uses the laws of physics to generate object motions. oPerformance Based (motion capture) - sensors record the actions of a human or animal object. A computer then uses these data to animate the object. This is popular with the animators mainly because human actions can be captured easily.
14
Interpolation-based animation: Keyframe Animation oThe keyframe of a model contains information such as the model's structure, position, orientation, and scale, e.g., 3 key frames:
15
Interpolation based Keyframe Animation oSuppose we have two keyframes that contain a bone structure with three joints (red, green and blue vertices) oWe render frame one, then an intermediate scene (obtained through interpolation) before rendering frame two for a more smooth animation flow e.g., linear interpolation: p = (1- p1 + p2 1- p1p2p
16
OpenGL Matrix Stacks oThere are 3 transformation matrix stacks: oModel-View - glMatrixMode(GL_MODELVIEW); oProjection - glMatrixMode(GL_PROJECTION); oTexture - glMatrixMode(GL_TEXTURE); oWhen Model-View mode starts, usually an identity matrix is created, which becomes the ‘current matrix’ and sits on top of the matrix stack oWhen other transformations are called later in the program, the current matrix is updated, e.g., multiplied by new matrices corresponding to the transformations called
17
OpenGL Matrix Stacks oSay you call glMatrixMode(GL_MODELVIEW), and glLoadIdentity(), OpenGL creates an identity matrix (1s on diagonal line 0s on others) oIf you then call glTranslatef(0,0,-250), the current matrix will be oIf you call glTranslatef(0,0,-250) again, current matrix will be: oIf you then call DrawCube() – the cube will be drawn at a distance of 500 from the origin, in the -Z direction
18
Push/Pop Matrix Stacks oIf at some point you need to turn back the clock, e.g., going back to a previous position of your object/scene, you should call glPushMatrix(), which will save a copy of the current matrix and put it on top of the stack oWhen you are ready to go back to the previous position, you should use glPopMatrix(), which will ‘pop’ the saved matrix off the stack, and you are back where you were
19
Push/Pop Matrix Stacks oThe modelling stack in action: oglPushMatrix(); oglTranslatef(0,10,0); oglPushMatrix(); oglTranslatef(10,0,0); oglRotatef(45,0,1,0); oglPushMatrix(); oglRotatef(45,0,1,0); oglPopMatrix(); I * T I * T * T I * T I * T * T * R I * T I * T * T * R I * T I * T * T * R I * T * T * R * R
20
Drawing a Hand using glPushMatrix()/ glPopMatrix() oSay you are at the centre of the palm (CoP) oglPushMatrix() to save a copy of current matrix oRotate and translate to draw thumb as a cylinder oglPopMatrix() so you are at the CoP again oglPushMatrix() to save a copy of current matrix oRotate and translate to draw index finger oglPopMatrix() so you are at the CoP again, ready to draw middle finger, and so on
21
L-Systems oRewriting is a technique for defining complex objects by successively replacing parts of an initial object using a set of rewriting rules oEssentially, generate a string that describes the object, replacing sub-strings with some new strings A rewriting system – the L-systems: oProduction rules below are applied ob → a. oa → ab. owhich means a is replaced by ab, b is replaced by a. initially we have word ab, now we have word aba oSimilarly, aba yields abaab which in turn yields abaababa, then abaababaabaab, and so on
22
L-Systems F : Move forward a step of length d. + : Turn left by angle δ. − : Turn right by angle δ a : F − F − F − F b : F → F − F + F + FF − F − F + F
23
L-Systems Prusinkiewicz, Hammel, Mech http://www.cpsc.ucalgary.ca/projects/bmv/vmm/title.html
24
Next Lab oHave fun with the Pixar lamp programs! oIntegrate them with the Framework provided, e.g., oadd Pixar lamp class/header to MyCode, ocreate a Pixar lamp object and add it to myScene oexperiment with different statements to change the lamp’s structure or appearance to understand the statements better oget help in the lab if you have an problem
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.