The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

Similar documents
Computer Graphics. Coordinate Systems and Change of Frames. Based on slides by Dianna Xu, Bryn Mawr College

Overview. By end of the week:

Computer Graphics: Viewing in 3-D. Course Website:

Interesting Application. Linear Algebra

Today. Rendering pipeline. Rendering pipeline. Object vs. Image order. Rendering engine Rendering engine (jtrt) Computergrafik. Rendering pipeline

Computer Graphics 7: Viewing in 3-D

Computer Viewing Computer Graphics I, Fall 2008

Beginning Direct3D Game Programming: 6. First Steps to Animation. Division of Digital Contents, DongSeo University.

Basic Elements. Geometry is the study of the relationships among objects in an n-dimensional space

CS230 : Computer Graphics Lecture 6: Viewing Transformations. Tamar Shinar Computer Science & Engineering UC Riverside

CSE 167: Lecture #4: Vertex Transformation. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2012

Perspective Mappings. Contents

Geometry. Prof. George Wolberg Dept. of Computer Science City College of New York

CMSC427 Transformations II: Viewing. Credit: some slides from Dr. Zwicker

Announcement. Project 1 has been posted online and in dropbox. Due: 11:59:59 pm, Friday, October 14

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design:

Virtual Cameras and The Transformation Pipeline

CS Exam 1 Review Problems Fall 2017

CSE 167: Introduction to Computer Graphics Lecture #4: Vertex Transformation

Culling. Computer Graphics CSE 167 Lecture 12

CS 432 Interactive Computer Graphics

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Overview. Viewing and perspectives. Planar Geometric Projections. Classical Viewing. Classical views Computer viewing Perspective normalization

Computer Viewing. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Geometry. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Drawing in 3D (viewing, projection, and the rest of the pipeline)

OpenGL Matrix/Vector Manipulation using SFML

3D Computer Graphics. Jared Kirschner. November 8, 2010

Rendering Objects. Need to transform all geometry then

A Conceptual and Practical Look into Spherical Curvilinear Projection By Danny Oros

CS354 Computer Graphics Viewing and Modeling

Drawing in 3D (viewing, projection, and the rest of the pipeline)

Computer Viewing and Projection. Overview. Computer Viewing. David Carr Fundamentals of Computer Graphics Spring 2004 Based on Slides by E.

3D Viewing. With acknowledge to: Ed Angel. Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Computer graphics 2: Graduate seminar in computational aesthetics

Viewing with Computers (OpenGL)

Game Mathematics. (12 Week Lesson Plan)

Overview of Projections: From a 3D world to a 2D screen.

Lecture 4: Transformations and Matrices. CSE Computer Graphics (Fall 2010)

Three-Dimensional Viewing Hearn & Baker Chapter 7

3D Polygon Rendering. Many applications use rendering of 3D polygons with direct illumination

CSE528 Computer Graphics: Theory, Algorithms, and Applications

JAMAICA_9th Grade Math Table of Content

CS451Real-time Rendering Pipeline

1 Transformations. Chapter 1. Transformations. Department of Computer Science and Engineering 1-1

C O M P U T E R G R A P H I C S. Computer Graphics. Three-Dimensional Graphics I. Guoying Zhao 1 / 52

CS488. Implementation of projections. Luc RENAMBOT

Matrix Operations with Applications in Computer Graphics

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

Game Architecture. 2/19/16: Rasterization

THE VIEWING TRANSFORMATION

CSE452 Computer Graphics

CSE328 Fundamentals of Computer Graphics

2D transformations: An introduction to the maths behind computer graphics

1 OpenGL - column vectors (column-major ordering)

For each question, indicate whether the statement is true or false by circling T or F, respectively.

Introduction to Computer Graphics with WebGL

3D Viewing Episode 2

Three-Dimensional Graphics III. Guoying Zhao 1 / 67

What does OpenGL do?

CS 130 Final. Fall 2015

TRANSFORMATIONS AND CONGRUENCE

Today s Agenda. Geometry

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Viewing Transformations

Lecture 3 Sections 2.2, 4.4. Mon, Aug 31, 2009

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

CS452/552; EE465/505. Geometry Transformations

3D Graphics Pipeline II Clipping. Instructor Stephen J. Guy

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Geometric transformations in 3D and coordinate frames. Computer Graphics CSE 167 Lecture 3

CS 543: Computer Graphics Midterm review. Emmanuel Agu

To Do. Outline. Translation. Homogeneous Coordinates. Foundations of Computer Graphics. Representation of Points (4-Vectors) Start doing HW 1

Rigid Body Motion and Image Formation. Jana Kosecka, CS 482

Computer Graphics. Chapter 7 2D Geometric Transformations

One or more objects A viewer with a projection surface Projectors that go from the object(s) to the projection surface

The Viewing Pipeline adaptation of Paul Bunn & Kerryn Hugo s notes

Chapter 5. Projections and Rendering

3D Viewing. CMPT 361 Introduction to Computer Graphics Torsten Möller. Machiraju/Zhang/Möller

Computer Graphics. P05 Viewing in 3D. Part 1. Aleksandra Pizurica Ghent University

The Graphics Pipeline and OpenGL I: Transformations!

Visualisation Pipeline : The Virtual Camera

Computer Graphics. Bing-Yu Chen National Taiwan University The University of Tokyo

Computer Viewing. CITS3003 Graphics & Animation. E. Angel and D. Shreiner: Interactive Computer Graphics 6E Addison-Wesley

Transformation Pipeline

Quaternions and Euler Angles

CSE 167: Introduction to Computer Graphics Lecture #10: View Frustum Culling

Fall CSCI 420: Computer Graphics. 2.2 Transformations. Hao Li.

Classical and Computer Viewing. Adapted From: Ed Angel Professor of Emeritus of Computer Science University of New Mexico

Viewing. Part II (The Synthetic Camera) CS123 INTRODUCTION TO COMPUTER GRAPHICS. Andries van Dam 10/10/2017 1/31

Today. Rendering algorithms. Rendering algorithms. Images. Images. Rendering Algorithms. Course overview Organization Introduction to ray tracing

INTRODUCTION TO COMPUTER GRAPHICS. It looks like a matrix Sort of. Viewing III. Projection in Practice. Bin Sheng 10/11/ / 52

Graphics pipeline and transformations. Composition of transformations

Rasterization Overview

Notes on Assignment. Notes on Assignment. Notes on Assignment. Notes on Assignment

3D Viewing. CS 4620 Lecture 8

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Evening s Goals. Mathematical Transformations. Discuss the mathematical transformations that are utilized for computer graphics

Data Visualization. What is the goal? A generalized environment for manipulation and visualization of multidimensional data

Transcription:

Hermann Chong Dr. King Linear Algebra Applications 28 November 2001 The Importance of Matrices in the DirectX API In the world of 3D gaming, there are two APIs (Application Program Interface) that reign supreme: OpenGL and DirectX. APIs help programmers write more efficiently by adding support in the programming language for frequently used calculations. Matrices are used a great deal in both APIs, but for the sake of brevity, this report will concentrate on the use of matrices in DirectX. DirectX uses matrices to express many objects, including 3d models, worlds, and perspectives. This report will discuss how the matrices are used, and how the API uses these calculations to make the programmer s code more efficient and powerful. In Direct3D (a subset of the DirectX API), every object that will be sent to the monitor must be transformed through a series of matrix multiplications. Each object in DirectX is made up of triangles, lines, or points, which are called primitives. Each primitive is defined by a matrix of vertices (x, y and z coordinates). These vertices are then rotated, scaled, and translated to a two dimensional plane that can be displayed to the monitor. The matrix transformations needed to bring the vertices to the monitor is shown below in Figure 1, which explains the transformation pipeline.

Figure 1. An example of the transformation pipeline. World Transformation The world transformation is a group of four matrix multiplications that move the different objects into the same world, effectively moving all the objects from their own local coordinate system to a common coordinate system. The four matrix multiplications are pitch, yaw, and roll, and a translation matrix. In order to use matrices to handle translating for three dimensional objects, the standard 3x3 matrix is replaced with a 4x4 matrix, called a homogenous matrix, seen below in Figure 2. A T q p r Figure 2. The structure of a homogenous matrix.

In Figure 2 above, A is a 3x3 matrix that is used for rotation and scaling, p is a used to translate points, q is a 3 vector 3 vector used to change the perspective, and r is a scalar. By multiplying this homogenous matrix with a (x, y, z, 1) vector, the vector can be repositioned anywhere. These transformations are done through the API by calling functions that create the rotation and translation matrixes, multiplying together, and then multiplying the final transformation matrix to the object. At the end, all the objects are converted from their own local coordinates to a global coordinate system. View Transformation The view transformation requires the same types of computations as the world transformation. This transformation changes the previous coordinate system to one where the viewpoint is located at the origin. The math for this transformation is excluded because the math behind this transformation is roughly the same as for the world transformation. Projection Transformation The projection transformation uses the result of the world and view transformations to translate the three dimensional objects into a cuboid shape. This is done by manipulating q in Figure 2. The transformation scales and translates the matrix, acting as the lens for the camera. As a result, objects in between the camera and the viewing plane are magnified, and the objects behind the viewing window are shrunk. This causes an illusion of perspective.

Clipping and Viewport Scaling After the transformations have been completed, Direct3D uses two clipping planes to determine what is seen in the window. An illustration of this is shown below in Figure 3. Figure 3. The clipping planes. The volume in between the two clipping planes contains the objects that will be shown on the computer monitor. Also needed to determine what is shown on the screen is the field of view, the angle between the horizontal and the top of the line that defines the edge of the clipping planes. The API clips by filtering through the triangles in the screen, determining if they are within the volume. If the triangles are not in the volume, the API does not render the triangle to the screen. The viewport is the two dimensional plane used to display all the objects on the screen. Viewport scaling simply moves the three dimensional objects onto a two dimensional plane, determined by the screen resolution of the computer monitor. Together, clipping and viewport scaling translates the world onto the screen.

Works Cited DirectX 8.1 SDK Documentation, Microsoft Corporation Section 2.8, Linear Algebra and its Applications, David C. Lay