150 likes | 498 Views
The 3D Pipeline. Jim Van Verth (jim@essentialmath.com) Lars M. Bishop (lars@essentialmath.com). The 3D Pipeline. Three problems: want to construct hierarchy of objects transformation of object combined with its children want to manipulate camera viewing transformation
E N D
The 3D Pipeline Jim Van Verth (jim@essentialmath.com) Lars M. Bishop (lars@essentialmath.com)
The 3D Pipeline • Three problems: • want to construct hierarchy of objects • transformation of object combined with its children • want to manipulate camera • viewing transformation • want to render objects to screen • projection/screen transformation Essential Math for Games
The 3D Pipeline • Where geometric objects are transformed through a series of spaces • They are fed in as 3D objects in their own space (model space) • They come out as pixels on the screen (screen space) Model World View NDC Screen Essential Math for Games
z x Model Space y • AKA local space, object space • Where object vertices are defined • Origin at center of object (or at pivot) • Right-handed is common • Z up arbitrary, also see Y-axis up Essential Math for Games
z x World Space y • Where objects are placed • Origin at center of world or scene • Right-handed is good (consistency) • View position, orientation usually expressed here Essential Math for Games
Hierarchical Spaces • Suppose have arm connected to body in world • First transform arm to body space • Then transform arm to world space • Standard order: scale, rotate, translate • Often, objects are modeled around a “pivot point” (e.g. shoulder for arm) Essential Math for Games
Hierarchical Transforms • First transform arm to body space MAB = TARAsA Arm in Arm’s Model Space Arm in Body’s Model Space Essential Math for Games DEMO
Hierarchical Transforms • Then body, arm to world space MBW = TBRBsB MAW = MBWMAB Essential Math for Games DEMO
Hierarchical Transforms • In practice, body and arm have separate transforms • Arm transform is relative to body • Draw body with its transform (MBW) • Draw arm with concatenation of body and arm transforms (MBW MAB) • Objects can move independently Essential Math for Games
Scene Graph • Common structure for hierarchical scenes • Jointed (or skinned) characters are the most frequent applications • Using like a tree – doesn’t have to be • Instancing makes it a DAG Essential Math for Games
Example Scene Graph Node Node Body Scene Graph need not be a binary tree! Nodes can have as many children as needed Node Turret Barrel Essential Math for Games
Scene Graph(One Implementation) • Spatial • Base class, handles transforms, bounds • Node • Maintains hierarchy (array of children) • Geometry • Leaf nodes, contain renderable geometry Essential Math for Games
Using Scene Graph • Update transforms • Pass down from top to geometry nodes • Concatenate and store world transforms at each level • Used for collision, culling • Render • Recursively call Render() on all children • Bounding volumes allow for fast culling Essential Math for Games DEMO
References • Foley, James D., Andries van Dam, et. al., Computer Graphics: Principles and Practice, Addison-Wesley, Reading, MA, 1990. • Blinn, Jim, Jim Blinn’s Corner: A Trip Down the Graphics Pipeline, Morgan Kaufman, San Francisco, 1996. • Eberly, David H., 3D Game Engine Design, Morgan Kaufmann, San Francisco, 2001. Essential Math for Games