3 - Fundamentals of 3D Systems

Similar documents
Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Introduction to Computer Graphics

3D Tranformations. CS 4620 Lecture 6. Cornell CS4620 Fall 2013 Lecture Steve Marschner (with previous instructors James/Bala)

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

Essential Mathematics for Computer Graphics fast

INTRODUCTION TO RENDERING TECHNIQUES

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

A Short Introduction to Computer Graphics

Lecture L3 - Vectors, Matrices and Coordinate Transformations

TWO-DIMENSIONAL TRANSFORMATION

Lecture 3: Coordinate Systems and Transformations

w = COI EYE view direction vector u = w ( 010,, ) cross product with y-axis v = w u up vector

Geometry of Vectors. 1 Cartesian Coordinates. Carlo Tomasi

Unified Lecture # 4 Vectors

Introduction to 2D and 3D Computer Graphics Mastering 2D & 3D Computer Graphics Pipelines

Silverlight for Windows Embedded Graphics and Rendering Pipeline 1

Rotation and Inter interpolation Using Quaternion Representation

Vector has a magnitude and a direction. Scalar has a magnitude

Solving Simultaneous Equations and Matrices

Lecture Notes, CEng 477

Vector Math Computer Graphics Scott D. Anderson

Geometric Camera Parameters

How To Teach Computer Graphics

Comp 410/510. Computer Graphics Spring Introduction to Graphics Systems

CS 4204 Computer Graphics

Realtime 3D Computer Graphics Virtual Reality

Abstract. Introduction

Adding vectors We can do arithmetic with vectors. We ll start with vector addition and related operations. Suppose you have two vectors

We can display an object on a monitor screen in three different computer-model forms: Wireframe model Surface Model Solid model

Rotation Matrices and Homogeneous Transformations

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 9 The Game Engine

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

Lesson 10: Video-Out Interface

Game Development in Android Disgruntled Rats LLC. Sean Godinez Brian Morgan Michael Boldischar

Computer Graphics Hardware An Overview

v w is orthogonal to both v and w. the three vectors v, w and v w form a right-handed set of vectors.

Lecture Notes. Fundamentals of Computer Graphics. Prof. Michael Langer School of Computer Science McGill University

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

ex) What is the component form of the vector shown in the picture above?

Cabri Geometry Application User Guide

Beginning Android 4. Games Development. Mario Zechner. Robert Green

v 1 v 3 u v = (( 1)4 (3)2, [1(4) ( 2)2], 1(3) ( 2)( 1)) = ( 10, 8, 1) (d) u (v w) = (u w)v (u v)w (Relationship between dot and cross product)

Figure 1.1 Vector A and Vector F

Programming 3D Applications with HTML5 and WebGL

L20: GPU Architecture and Models

3D Viewing. Chapter 7. Projections. 3D clipping. OpenGL viewing functions and clipping planes

Chapter 17. Orthogonal Matrices and Symmetries of Space

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg

Physics 235 Chapter 1. Chapter 1 Matrices, Vectors, and Vector Calculus

Ultra-High Resolution Digital Mosaics

Gursharan Singh Tatla Page No. 1 COMPUTER GRAPHICS (Short Answer type Questions)

H.Calculating Normal Vectors

MovieClip, Button, Graphic, Motion Tween, Classic Motion Tween, Shape Tween, Motion Guide, Masking, Bone Tool, 3D Tool

CS 4204 Computer Graphics

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

GPU Architecture. Michael Doggett ATI

Section 1: How will you be tested? This section will give you information about the different types of examination papers that are available.

Fundamentals of Computer Animation

4D Interactive Model Animations

13 MATH FACTS a = The elements of a vector have a graphical interpretation, which is particularly easy to see in two or three dimensions.

Mondays and Thursdays, 10:05-11:25, F24-406

Graphical displays are generally of two types: vector displays and raster displays. Vector displays

Rotation about an arbitrary axis and reflection through an arbitrary plane

3D Math Overview and 3D Graphics Foundations

Pro/ENGINEER Wildfire 4.0 Basic Design

Chapter 8 Geometry We will discuss following concepts in this chapter.

28 CHAPTER 1. VECTORS AND THE GEOMETRY OF SPACE. v x. u y v z u z v y u y u z. v y v z

Math 241, Exam 1 Information.

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Introduction to Computer Graphics. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Section 1.1. Introduction to R n

Affine Transformations

Architecture for Direct Model-to-Part CNC Manufacturing

GeoGebra. 10 lessons. Gerrit Stols

How To Draw A Billiards Ball In Gta 3D With Texture Mapping (Gta 3) On A Computer Or 2D Or Gta 2D (Gt) On Your Computer Or Computer Or Your Computer (Or Your Computer)

CMSC 425: Lecture 13 Animation for Games: Basics Tuesday, Mar 26, 2013

Math for Game Programmers: Dual Numbers. Gino van den Bergen

Computer Graphics Labs

The following is an overview of lessons included in the tutorial.

Compositing a 3D character over video footage in Maya Jean-Marc Gauthier, Spring 2008

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

Pro/E Design Animation Tutorial*

3D MODEL DRIVEN DISTANT ASSEMBLY

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. M.Sc. in Advanced Computer Science. Friday 18 th January 2008.

4BA6 - Topic 4 Dr. Steven Collins. Chap. 5 3D Viewing and Projections

A Proposal for OpenEXR Color Management

mouse (or the option key on Macintosh) and move the mouse. You should see that you are able to zoom into and out of the scene.

Solutions for Review Problems

Geometry Notes PERIMETER AND AREA

2-View Geometry. Mark Fiala Ryerson University

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Chapter 6 - The Scene Graph

Geometric Modelling & Curves

Scripting in Unity3D (vers. 4.2)

Tutorial 9: Skeletal Animation

B4 Computational Geometry

OpenGL Performance Tuning

Geometry for Computer Graphics

Lecture 7. Matthew T. Mason. Mechanics of Manipulation. Lecture 7. Representing Rotation. Kinematic representation: goals, overview

Transcription:

CSc 65 Computer Game Architecture 3D Coordinate Systems 3 - Fundamentals of 3D Systems P (x,y,z) Right-handed Coordinate System P (x,y,z) Left-handed Coordinate System Points can be represented in homogeneous form: P [x y z ] 2 Synthetic Camera Paradigm ear Clipping Plane iew olume Projection Plane Far Clipping Plane Eye (camera) The Camera Two important camera attributes: Location Orientation of axes ote the coordinate system is left-handed + yaw ( azimuth ) + roll ( up ) World Objects + pitch ( colatitude or elevation ) 3 4 Generalized Camera Control Player controls position & orientation World points must be converted to camera points Game engine should handle this (it s game-independent) Additional Camera Settings FO, Aspect, ear & Far (Clipping) Controls projection onto 2D plane (& screen) Again, game engine should handle details w Line of sight World point Field of iew (FO) angle in Width Height w w near Aspect Ratio width / height 5 far 6

Sage Default Camera alues Sage Camera/Display Structure Loc [0 0 ], looking down negative fov 60, aspect, near0.0, far00 IDisplaySystem IRenderer ICamera DisplaySystem Renderer Camera JFrame Canvas 60 00 Game loop render() step causes camera view (contents of iew olume) to be drawn on Renderer s Canvas in DisplaySystem s JFrame 7 8 SAGE s ICamera Interface //This interface defines the functions provided by all camera implementations public interface ICamera { // get the camera s location/orientation public Point3D getlocation(); public ector3d getrightaxis(); public ector3d getpaxis(); public ector3d getiewdirection(); Camera Manipulation example: Move Forward change location along the view direction CurLoc //modify the camera s location/orientation (note that it is the user s //responsibility to insure the camera axes remain mutually perpendicular) public void setlocation(point3d loc); public void setrightaxis(ector3d right); public void setpaxis(ector3d up); public void setiewdirection(ector3d viewdir); public void setaxes(ector3d right, ector3d up, ector3d viewdir); //query/alter the iew olume associated with the camera public double[] getperspectivefrustumsettings(); public void setperspectivefrustum(double fov, double aspect, double near, double far); //... other methods to be seen later... CurLoc As ector iewdirector () ewloc ewloc CurLocAsector + (iewdirector*moveamount) 9 0 Defining Simple 3D Models Rasterization Output ertex 2 0 (0,, 0) Color red (-, -, ) Color green 2 (, -, ) Color blue 3 (, -, -) Color yellow 4 (-, -, -) Color magenta Scan lines (pixel raster rows) A 2x2x2 Pyramid Centered At The Origin Output ertex 0 2 Output ertex

Application Code Graphics API (OpenGL or Direct) Interpolation Result Pyramid Data Structures ertices 0 0 0 - - 2-3 - - 4 - - - Geometry one vertex red green blue yellow magenta Color one vertex index Triangles 0 0 2 0 2 3 2 0 3 4 3 0 4 4 4 2 5 4 3 2 Indexes 3 4 The Graphics Pipeline ertex Graphics Card Fragment ( pixel ) Primitive Assembly Primitive (Projection, Clipping) Fragment Testing (Blending, HSR, etc.) Implemented by the combination of the graphics driver (software), and graphics (hardware) card Can be FIED-FCTIO or PROGRAMMABLE, depending on implementation version ertices Other Data Rasterization Frame Buffer (Memory) Display 3D Transformations eeded for a wide variety of operations: Modeling Positioning & orienting objects in the 3D virtual world Camera positioning ( viewing ) Creating the 2D screen view of the 3D world view ( projection ) Making objects move, grow, spin, fly, etc. Client Side Server Side 5 6 Translation (column-major form): Scaling (column-major form): (x+t x ) (y+t y ) (z+t z ) 0 0 T x 0 0 T y 0 0 T z 0 0 0 * x y z (x*s x ) (y*s y ) (z*s z ) S x 0 0 0 0 S y 0 0 0 0 S z 0 0 0 0 * x y z 7 8

3D Rotation Recall 2D rotations can be about any point o For simplicity we define only 2D rotation about the origin o Other rotations require translation to/from the origin Similarly, 3D rotations can be about any line (any axis of rotation ) : Axis of Rotation Euler s Theorem Any rotation (or sequence of rotations) about a point is equivalent to a single rotation about some axis through that point. [Leonard Euler, 707-783] This is equivalent to saying: Rotation about an arbitrary line through the origin can be accomplished by an equivalent set of rotations about the,, and axes. Arbitrary Point Thus we can rotate about an arbitrary axis as follows:. Translate the axis so it goes through the origin, 2. Rotate by the appropriate Euler angles about,, and, and 3. ndo the translation 9 20 isualizing Euler s Theorem 3D Rotation Transforms Desired point rotation Axis of Rotation Rotation about by θ: 0 0 0 0 cos θ -sin θ 0 0 sin θ cos θ 0 0 0 0 Euler angle rotations to accomplish desired rotation 2 22 Rotation about by θ: Rotation about by θ: cos θ 0 sin θ 0 cos θ -sin θ 0 0 0 0 0 -sin θ 0 cos θ 0 0 0 0 sin θ cos θ 0 0 0 0 0 0 0 0 23 24

Rotation in Angle/Axis Form Rotation Axis [ ] Rotation Angle * * Positive rotation CCW as seen from vector (axis) head, looking toward tail at origin (right hand rule) rotate(60, x, y, z) Representing Transforms Package graphicslib3d Class Matrix3D : a 4x4 ( 3D ) matrix Methods for specifying translation, rotation, & scaling, obtaining transpose and inverse, etc. Similar to Java s AffineTransform (but 3D) Class ector3d : a 4-element ( 3D ) vector Methods for most common vector operations: add, dot- and cross-product, magnitude, normalize seful for representing, for example, a rotation axis 25 26 Sceneode Hierarchy Every object in a scene is an instance of class sage.scene.sceneode, which provides local translate, rotate, and scale matrices Predefined classes in package: sage.scene.shape <<abstract>> Sceneode -localtranslation : Matrix3D -localrotation : Matrix3D -localscale : Matrix3D... + translate(tx,ty,tz) + rotate(degrees,axis) + scale(sx, sy, sz) Apply the specified transform to the local matrix Cube Cylinder Line Pyramid Sphere Teapot... Detecting Camera Collisions Sage Sceneodes have bounding volumes (B s) called their world bound B contains() method can be used to check for camera collisions: for (Sceneode s : getgameworld()) // getgameworld is inherited from BaseGame { if (s.getworldbound()! null) { if (s.getworldbound().contains(cameraloc)) { // do whatever should happen when camera hits an object; // e.g., mark object for removal from game and increment score 27 28