Engineering Real- Time Applications with Wild Magic

Similar documents
Computer Animation. Algorithms and Techniques. z< MORGAN KAUFMANN PUBLISHERS. Rick Parent Ohio State University AN IMPRINT OF ELSEVIER SCIENCE

AMSTERDAM BOSTON HEIDELBERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO F ^ k.^

CS GAME PROGRAMMING Question bank

Real-Time Rendering. Tomas Möller Eric Haines. A K Peters Natick, Massachusetts

Programming Guide. Aaftab Munshi Dan Ginsburg Dave Shreiner. TT r^addison-wesley

Introduction to Computer Graphics

Mathematical Tools in Computer Graphics with C# Implementations Table of Contents

MODELING AND HIERARCHY

Computers as Components Principles of Embedded Computing System Design

Embedded Systems Architecture

Foundations of Multidimensional and Metric Data Structures

Advanced 3D Game Programming with DirectX* 10.0

GEOMETRIC TOOLS FOR COMPUTER GRAPHICS

Interactive Computer Graphics A TOP-DOWN APPROACH WITH SHADER-BASED OPENGL

Building scalable 3D applications. Ville Miettinen Hybrid Graphics

6.837 Introduction to Computer Graphics Final Exam Tuesday, December 20, :05-12pm Two hand-written sheet of notes (4 pages) allowed 1 SSD [ /17]

Information Modeling and Relational Databases

Programming 8-bit PIC Microcontrollers in С

CHAPTER 1 Graphics Systems and Models 3

An Introduction to Programming with IDL

GLOBAL EDITION. Interactive Computer Graphics. A Top-Down Approach with WebGL SEVENTH EDITION. Edward Angel Dave Shreiner

CLASSIC DATA STRUCTURES IN JAVA

Graphics Shaders. Theory and Practice. Second Edition. Mike Bailey. Steve Cunningham. CRC Press. Taylor&FnincIs Croup tootutor London New York

An Introduction to Parallel Programming

MPEG-l.MPEG-2, MPEG-4

Structured Parallel Programming

Algorithmic Graph Theory and Perfect Graphs

Structured Parallel Programming Patterns for Efficient Computation

PTC Mathcad Prime 3.0

Computer Architecture A Quantitative Approach

Maya Python. for Games and Film. and the Maya Python API. A Complete Reference for Maya Python. Ryan Trowbridge. Adam Mechtley ELSEVIER

M (~ Computer Organization and Design ELSEVIER. David A. Patterson. John L. Hennessy. University of California, Berkeley. Stanford University

Essential MATLAB for Engineers and Scientists

Lecture 25 of 41. Spatial Sorting: Binary Space Partitioning Quadtrees & Octrees

The Essential Guide to Video Processing

Scene Management. Video Game Technologies 11498: MSc in Computer Science and Engineering 11156: MSc in Game Design and Development

Curves and Surfaces for Computer-Aided Geometric Design

Many rendering scenarios, such as battle scenes or urban environments, require rendering of large numbers of autonomous characters.

VIII. Visibility algorithms (II)

Direct Rendering of Trimmed NURBS Surfaces

Announcements. Written Assignment2 is out, due March 8 Graded Programming Assignment2 next Tuesday

Homework 1: Implicit Surfaces, Collision Detection, & Volumetric Data Structures. Loop Subdivision. Loop Subdivision. Questions/Comments?

Lahore University of Management Sciences. CS 452 Computer Graphics

The Designer's Guide to VHDL Second Edition

RSX Best Practices. Mark Cerny, Cerny Games David Simpson, Naughty Dog Jon Olick, Naughty Dog

Digital Signal Processing System Design: LabVIEW-Based Hybrid Programming Nasser Kehtarnavaz

Graphics and Interaction Rendering pipeline & object modelling

Spatial Data Structures. Steve Rotenberg CSE168: Rendering Algorithms UCSD, Spring 2017

Lecture 13: Reyes Architecture and Implementation. Kayvon Fatahalian CMU : Graphics and Imaging Architectures (Fall 2011)

Subdivision Of Triangular Terrain Mesh Breckon, Chenney, Hobbs, Hoppe, Watts

Coding for Penetration

CS535 Fall Department of Computer Science Purdue University

Dietrich Paulus Joachim Hornegger. Pattern Recognition of Images and Speech in C++

Computer Graphics I Lecture 11

5 Linear Algebra Determinants Matrices...121

Practical UML Statecharts in C/C++

Simulation in Computer Graphics. Introduction. Matthias Teschner. Computer Science Department University of Freiburg

MSP430 Microcontroller Basics

3D GRAPHICS. design. animate. render

ARCHITECTURE DESIGN FOR SOFT ERRORS

LOD and Occlusion Christian Miller CS Fall 2011

Managed. Code Rootkits. Hooking. into Runtime. Environments. Erez Metula ELSEVIER. Syngress is an imprint of Elsevier SYNGRESS

Principles of Computer Game Design and Implementation. Revision Lecture

System Assurance. Beyond Detecting. Vulnerabilities. Djenana Campara. Nikolai Mansourov

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Lecture 22 of 41. Animation 2 of 3: Rotations, Quaternions Dynamics & Kinematics

Rendering Grass with Instancing in DirectX* 10

Spatial Data Structures

Computer Graphics Introduction. Taku Komura

Cloth Simulation. COMP 768 Presentation Zhen Wei

Spatial Data Structures

COMP 4801 Final Year Project. Ray Tracing for Computer Graphics. Final Project Report FYP Runjing Liu. Advised by. Dr. L.Y.

The Power of Events. An Introduction to Complex Event Processing in Distributed Enterprise Systems. David Luckham

CS770/870 Spring 2017 Animation Basics

CS770/870 Spring 2017 Animation Basics

Animation Essentially a question of flipping between many still images, fast enough

EECE 478. Learning Objectives. Learning Objectives. Rasterization & Scenes. Rasterization. Compositing

- Location: Annenberg Text: Mostly Self-Contained on course Web pages. - Al Barr

CSE 167: Introduction to Computer Graphics Lecture 11: Scene Graph 2. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2013

Review. Stephen J. Guy

Cloth Simulation. Tanja Munz. Master of Science Computer Animation and Visual Effects. CGI Techniques Report

Next-Generation Graphics on Larrabee. Tim Foley Intel Corp

You can also export a video of what one of the cameras in the scene was seeing while you were recording your animations.[2]

TDA362/DIT223 Computer Graphics EXAM (Same exam for both CTH- and GU students)

Collision Detection. Pu Jiantao.

Fundamentals of. Database Systems. Shamkant B. Navathe. College of Computing Georgia Institute of Technology PEARSON.

Lahore University of Management Sciences. CS 452 Computer Graphics

Subdivision Surfaces. Homework 1: Last Time? Today. Bilinear Patch. Tensor Product. Spline Surfaces / Patches

Black Desert Online. Taking MMO Development to the Next Level. Dongwook Ha Gwanghyeon Go

Godot engine Documentation

Spatial Data Structures

OpenGL SUPERBIBLE. Fifth Edition. Comprehensive Tutorial and Reference. Richard S. Wright, Jr. Nicholas Haemel Graham Sellers Benjamin Lipchak

MULTIDIMENSIONAL SIGNAL, IMAGE, AND VIDEO PROCESSING AND CODING

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

The Application Stage. The Game Loop, Resource Management and Renderer Design

Consider a partially transparent object that is illuminated with two lights, one visible from each side of the object. Start with a ray from the eye

Open-Source Robotics and Process Control Cookbook

Database Modeling And Design The Fundamental Principles The Morgan Kaufmann Series In Data Management Systems

Networked Graphics 01_P374423_PRELIMS.indd i 10/27/2009 6:57:42 AM

the Simulation of Dynamics Using Simulink

Transcription:

3D GAME ENGINE ARCHITECTURE Engineering Real- Time Applications with Wild Magic DAVID H. EBERLY Geometric Tools, Inc. AMSTERDAM BOSTON HEIDELRERG LONDON NEW YORK OXFORD PARIS SAN DIEGO SAN FRANCISCO SINGAPORE SYDNEY TOKYO ELSEVIER Morgan Kaufmann is an imprint of Elsevier MORGAN KAUFMANN PUBLISHERS :<*

CONTENTS ABOUT THE AUTHOR PREFACE V xiii 1 m. INTRODUCTION 1.1 DRAWING A TRIANGLE 2 1.2 DRAWING A TRIANGLE MESH 17 1.3 DRAWING A COMPLICATED SCENE 27 1.4 ABSTRACTION OF SYSTEMS 27 CORE SYSTEMS 31 Z.I THE LOW-LEVEL SYSTEM 31 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2 THE MATHEMATICS SYSTEM 53 THE 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 LOW-LEVEL SYSTEM Basic Data Structures Encapsulating Platform-Specific Concepts Endianness System Time File Handling Memory Allocation and Deallocation Basic Mathematics Functions Fast Functions Vectors Matrices Quaternions Lines and Planes Colors 33 45 46 47 48 49 53 57 61 75 90 102 103 2.3 THE OBJECT SYSTEM 105 2.3.1 Run-Time Type Information 105 2.3.2 Names and Unique Identifiers 112 2.3.3 Sharing and Smart Pointers 114 2.3.4 Controllers 121 vii

viii Contents 2.3.5 Streaming 122 2.3.6 Cloning 133 2.3.7 String Trees 138 2.3.8 Initialization and Termination 139 O SCENE GRAPHS AND RENDERERS 149 3.1 THE CORE CLASSES 152 3.1.1 Motivation for the Classes 153 3.1.2 Spatial Hierarchy Design 160 3.1.3 Instancing 163 3.2 GEOMETRIC STATE 166 3.2.1' Transformations 167 3.2.2 Bounding Volumes 177 3.2.3 The Core Classes and Geometric Updates 184 3.3 GEOMETRIC TYPES 196 3.3.1 Points 197 3.3.2 Line Segments 198 3.3.3 Triangle Meshes 200 3.3.4 Particles 202 3.4 RENDER STATE 203 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 Global State Lights Textures Multitexturing Effects The Core Classes and Render State Updates 203 223 230 242 248 251 3.5 RENDERERS AND CAMERAS 259 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 Camera Models Basic Architecture for Rendering Single-Pass Drawing The DrawPrimitive Function Cached Textures and Vertex Attributes Global Effects and Multipass Support 259 276 281 285 292 295 ADVANCED SCENE GRAPH TOPICS 299 4.1 LEVEL OF DETAIL 299

Contents ix 4.1.1 Billboards. 300 4.1.2 Display of Particles 302 4.1.3 Discrete Level of Detail 306 4.1.4 Continuous Level of Detail 309 4.1.5 Infinite Level of Detail 334 4.2 SORTING 335 4.2.1 4.2.2 4.2.3 4.2.4 Binary Space Partitioning Trees Portals Sorting Children of a Node Deferred Drawing 336 343 354 356 4.3 CURVES AND SURFACES 360 4.3.1 4.3.2 Parametric Curves Parametric Surfaces 362 364 f 4.3.3 Curve Tessellation by Subdivision 366 4.3.4 Surface Tessellation by Subdivision 4.4 TERRAIN 377 4.4.1 4.4.2 4.4.3 377 378 388 4.5 CONTROLLERS AND ANIMATION 399 4.5.1 4.5.2 4.5.3 4.5.4 4.5.5 Data Representations Level of Detail Terrain Pages and Memory Management Keyframe Animation Morphing Points and Particles Skin and Bones Inverse Kinematics 402 404 406 410 414 ADVANCED RENDERING TOPICS 431 5.1 SPECIAL EFFECTS USING THE FIXED-FUNCTION PIPELINE 431 5.1.1 Vertex Coloring 433 5.1.2 Single Textures 434 5.1.3 Dark Maps 436 5.1.4 Light Maps 437 5.1.5 Gloss Maps 437 5.1.6 Bump Maps 440 5.1.7 Environment Maps 446 5.1.8 Projected Textures 451 5.1.9 Planar Shadows 454 5.1.10 Planar Reflection 457

X Contents 5.2 SPECIAL EFFECTS USING VERTEX AND PIXEL SHADERS 462 5.2.1 Scene Graph Support 463 5.2.2 Renderer Support 479 5.2.3 Automatic Source Code Generation 486 w COLLISION DETECTION 487 6.1 DISTANCE-BASED METHODS 492 6.1.1 A Plan of Attack 495 6.1.2 Root Finding Using Newton's Method 496 6.1.3 Root Finding Using Bisection 496 6.1.4 Hybrid Root Finding 497 6.1.5 An Abstract Interface for Distance Calculations 497 6.2 INTERSECTION-BASED METHODS 500 6.2.1 An Abstract Interface for Intersection Queries 501 6.3 LINE-OBJECT INTERSECTION 503 6.3.1 Intersections between Linear Components and Triangles 503 6.3.2 Intersections between Linear Components and Bounding Volumes 508 6.3.3 Picking 527 6.3.4 Staying on Top of Things 534 6.3.5 Staying out of Things 535 6.4 OBJECT-OBJECT INTERSECTION 536 6.4.1 Collision Groups 536 6.4.2 Hierarchical Collision Detection 540 6.4.3 Spatial and Temporal Coherence 553 / PHYSICS 565 7.1 NUMERICAL METHODS FOR SOLVING DIFFERENTIAL EQUATIONS 565 7.1.1 Eider's Method 567 7.1.2 Midpoint Method 569 7.1.3 Runge-Kutta Fourth-Order Method 571 7.1.4 Implicit Equations and Methods 573 7.2 PARTICLE PHYSICS 576 7.3 MASS-SPRING SYSTEMS 580 7.3.1 Curve Masses 580

Contents xi 7.3.2 Surface Masses 583 7.3.3 Volume Masses 586 7.3.4 Arbitrary Configurations 589 7.4 DEFORMABLE BODIES 591 7.5 RIGID BODIES 592 7.5.1 The Rigid Body Class 595 7.5.2 Computing the Inertia Tensor 600 APPLICATIONS 601 8.1 ABSTRACTION OF THE APPLICATION 602 8.1.1 Processing Command Line Parameters 603 8.1.2 The Application Class 607 8.1.3 The ConsoleApplication Class 609 8.1.4 The WindowApplication Class 612 8.1.5 The WindowApplication3 Class 620 8.2 SAMPLE APPLICATIONS 637 8.2.1 BillboardNode Sample 642 8.2.2 BspNode Sample 642 8.2.3 CachedArray Sample 645 8.2.4 Castle Sample 646 8.2.5 ClodMesh Sample 648 8.2.6 Collision Sample 648 8.2.7 InverseKinematics Sample 654 8.2.8 Portals Sample 656 8.2.9 ScreenPolygon Sample 662 8.2.10 SkinnedBiped Sample 668 8.2.11 SortFaces Sample 669 8.2.12 Terrain Sample 670 8.3 SAMPLE TOOLS 673 8.3.1 3dsToWmof Importer 673 8.3.2 Maya and Max Exporters 673 8.3.3 BmpToWmif Converter 673 8.3.4 WmifToBmp Converter 674 8.3.5 ScenePrinter Tool 674 8.3.6 SceneTree Tool 674 8.3.7 SceneViewer Tool 674

Xll Contents APPENDIX CODING CONVENTIONS 677 A.I FILE NAMING AND ORGANIZATION 677 A.2 COMMENT PREAMBLE AND SEPARATORS 680 A.3 WHITE SPACE 681 A.3.1 Indentation 681 A.3.2 Blank Lines 682 A.3.3 Function Declarators 682 A.3.4 Constructor Initializers 683 A.3.5 Function Calls 684 A.3.6 Conditionals 684 A.4 BRACES 685 A.5 POINTER TYPES 686 A.6 IDENTIFIER NAMES 688 A.6.1 Variables 688 A.6.2 Classes and Functions 690 A.6.3 Enumerations 690 A.7 C++ EXCEPTIONS 691 A.8 HEADER FILE ORGANIZATION 692 A.8.1 Include Guards and Nested Header Files 692 A.8.2 Minimizing Compilation Time 695 BIBLIOGRAPHY 699 INDEX 703 ABOUT THE CD-ROM 733