Text Outline of 3D Concepts Slides - 10 March 2009 3D Concepts - Coordinate Systems • Coordinates specify points in space • 3D coordinates commonly use X, Y, & Z • A vertex is a 'corner' of an object • Different coordinate systems have different measurement orientations • 3D objects in isolation are measured in object space • 3D views are measured in world space • XNA Game Studio world space is right-handed 3D Models • Defined by their vertices • Simple 3D models are called primitives: cylinder, cube, cone, sphere • Simplified model views often use an axis bug instead of a full axis rendition 3D Shapes • Defined by their polygons • Usually triangles are used to define polygons • 3D shapes are often called meshes • 3D accelerated graphics cards work best with triangle polygons • The polygons that make up a shape are called faces • Faces within a shape that are not viewable are called hidden faces • Faces on the backside of a shape are called back faces Displaying 3D Models - Three-step process: 1. Convert to world space (transformation) 2. Convert to view space (3D rendering) 3. Convert to screen space (2D rendering) Displaying 3D Models - Transformation - 3 main types • Scaling • Rotating • Translating Displaying 3D Models - Scaling • Multiply measurements in each axis • Apply to all of a shape's vertices • Scale factors larger than 1 will make object bigger • Scale factors smaller than 1 will make object smaller • Scale factors of 0 or less are not applicable Displaying 3D Models - Rotation • Each axis is rotated in turn • Order of rotation matters • Roll: rotate around longitudinal (Z) axis • Pitch: rotate around lateral (X) axis • Yaw: rotate around vertical (Y) axis • Common convention is roll-pitch-yaw ordering Displaying 3D Models - Translation • Moves an object in space • Vectors are applied to a shape's vertices to translate it • Shape is not changed • Shape is not re-oriented Displaying 3D Models - Rendering • Process of converting a 3D model of a shape to 2D picture • Shading • Mapping • Graphing Displaying 3D Models - Rendering • Flat Shading • Lambert Shading • Gouraud Shading • Phong Shading • Fake Phong Shading • Texture Mapping • Shaders • Bump Mapping • Environment Mapping • Mipmapping • Scene Graphs Displaying 3D Models - 3D Audio • Positioning sound in 3D using stereo • Balancing left & right & volume control can approximate 3D position of sound Displaying 3D Models - 3D Programming • XNA has built-in methods to use • Scenegraph insertion is not automatic, but is a useful abstraction • placing (spawning) • transforming • allows us to manually manipulate objects as well • Real-time scene manipulation Summary • 3D coordinates can be expressed as left-handed or right-handed • Objects are designed in object space, placed in game world in world space • Object space may use a different coordinate system than world space, and each uses a different center (zero reference) • Changing an object's size, orientation, or location is called transforming the object • Order of transformation matters • The axis order of rotation matters • Converting the mathematical description of an object to a visual representation on a screen is called rendering • Scene graphs contain and organize objects in a world in preparation for rendering and manipulation • XNA provides many methods for manipulating and moving 3D objects in real time • 3D Audio effects can be handled in exactly the same way as regular 3D objects