SM3107 CG Fundamentals for Animators From object to world coordinate SM3107 CG Fundamentals for Animators Last week… Vertices of a triangle Object-to-world transform World-to-camera transform Projection Viewport transform 2D image SM3107 CG Fundamentals for Animators This week… Vertices of a triangle Object-to-world transform World-to-camera transform Projection Viewport transform 2D image SM3107 CG Fundamentals for Animators From object to world coordinate Each object has its own coordinate system. Each object has its own center and 3 axes. We call it “object coordinate system”. Object coordinate is useful for defining the relation between an object and its components. For example, a robot’s head is always 5 units from its pelvis, no matter where the robot is in the virtual world. The virtual world has a “world coordinate system”. There is a shared origin and 3 axes. We put objects in the virtual world by using object-toworld transformation. Basically translate, rotate and scale. SM3107 CG Fundamentals for Animators From object to world Example translateX = 1 translateY = 0.5 translateZ = -4 SM3107 CG Fundamentals for Animators Math calculation Translate: how to calculate (x’,y’) from (x,y)? Y Y (x’,y’) (x,y) X X SM3107 CG Fundamentals for Animators x’ = x + translateX y’ = y + translateY Math calculation Scale (x’,y’) (x,y) X X SM3107 CG Fundamentals for Animators x’ = x * scaleX y’ = y * scaleY Math calculation Rotate (about z-axis) NOTE: in these equations, rotation follows the “left-hand” rule. (x’,y’) (x,y) X X x’ = x*cosθ - y*sinθ y’ = x*sinθ + y*cosθ NOTE: in these equations, scale and rotate are always referring to the “world” origin. SM3107 CG Fundamentals for Animators A sequence of transformation Note that the order of a sequence of transformation is important. Different order gives you different result. Rotate Y first, then rotate X Rotate X first, then rotate Y A sequence of transformation: another example Translate and then rotate Y Y X Y X X Rotate and then translate Y Y X Y X X Some remarks: In most 3D software (e.g. Maya), there is some fundamental differences from our formula: In our formula, all rotation and scaling are about the “world” origin. In most 3D software, usually all rotation and scale are relative to the object’s local axes. Therefore, whether the object is translated-before-rotated or rotated-beforetranslated doesn’t matter. In most 3D software, the order of rotations (about the 3 axes) can be specified. The default is rotate about X first, then rotates about Y, and then rotates about Z. SM3107 CG Fundamentals for Animators Transformation in Maya SM3107 CG Fundamentals for Animators Transformation in Maya SM3107 CG Fundamentals for Animators A sequence of transformation: math calculation Example: first translate (translateX=2, translateY=0), and then rotate 45 degree. First translate: x’ = x + 2 y’ = y + 0 Then rotate: x’’ = x’ * cos45 – y’ * sin45 y’’ = x’ * sin45 + y’ * cos45 Combine together: x’’ = (x+2)* cos45 – (y+0) * sin45 y’’ = (x+2)* sin45 + (y+0) * cos45 SM3107 CG Fundamentals for Animators A sequence of transformation: math calculation Example: first rotate 45 degree, and then translate (translateX=2, translateY=0). First rotate: x’ = x * cos45 – y * sin45 y’ = x * sin45 + y * cos45 Then translate x’’ = x’ + 2 y’’ = y’ + 0 Combine together: x’’ = (x * cos45 – y * sin45) + 2 y’’ = (x * sin45 + y * cos45) + 0 SM3107 CG Fundamentals for Animators Math calculation Extend the mathematics to 3D, we have: Translate: x’ = x + translateX y’ = y + translateY z’ = z + translateZ Scale: x’ = x * scaleX y’ = y * scaleY z’ = z * scaleZ Rotate about x-axis: x’ = x y’ = y*cosθ - z*sinθ z’ = y*sinθ + z*cosθ Rotate about y-axis: x’ = x*cosθ + z*sinθ y’ = y z’ = -x*sinθ + z*cosθ SM3107 CG Fundamentals for Animators Rotate about z-axis: x’ = x*cosθ - y*sinθ y’ = x*sinθ + y*cosθ z’ = z
© Copyright 2026 Paperzz