ebook img

3D Game Engine Design: A Practical Approach to Real-Time Computer Graphics PDF

1022 Pages·2006·9.64 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview 3D Game Engine Design: A Practical Approach to Real-Time Computer Graphics

3D Game Engine Design A Practical Approach to Real-Time Computer Graphics Second Edition David H. Eberly Geometric Tools, Inc. AMSTERDAM•BOSTON•HEIDELBERG•LONDON NEWYORK•OXFORD•PARIS•SANDIEGO SANFRANCISCO•SINGAPORE•SYDNEY•TOKYO MorganKaufmannisanimprintofElsevier SeniorEditor TimCox PublishingServicesManager GeorgeMorrison SeniorProductionEditor BrandyLilly ProjectManagement ElisabethBeller CoverDesign ChenDesignAssociates,SanFrancisco TextDesign RebeccaEvans Composition WindfallSoftware,usingZzTEX TechnicalIllustration DartmouthPublishing Copyeditor YonieOverton Proofreader JenniferMcClain Indexer SteveRath InteriorandCoverPrinter HingYipPrinters,Ltd. MorganKaufmannPublishersisanimprintofElsevier. 500SansomeStreet,Suite400,SanFrancisco,CA94111 Thisbookisprintedonacid-freepaper. ©2007byElsevierInc.Allrightsreserved. Designations used by companies to distinguish their products are often claimed as trademarks or registered trademarks. In all instances in which Morgan Kaufmann Publishers is aware of a claim, the product names appear in initial capital or all capitalletters.Readers,however,shouldcontacttheappropriatecompaniesformore completeinformationregardingtrademarksandregistration. Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortrans- mittedinanyformorbyanymeans—electronic, mechanical, photocopying, scan- ning,orotherwise—withoutpriorwrittenpermissionofthepublisher. PermissionsmaybesoughtdirectlyfromElsevier’sScience&TechnologyRightsDe- partmentinOxford,UK:phone:(+44)1865843830,fax:(+44)1865853333,e-mail: permissions@elsevier.com.YoumayalsocompleteyourrequestonlineviatheElsevier homepage (http://elsevier.com), by selecting “Support & Contact” then “Copyright andPermission”andthen“ObtainingPermissions.” LibraryofCongressCataloging-in-PublicationData:Applicationsubmitted ISBN13:978-0-12-229063-3 ISBN10:0-12-229063-1 ForinformationonallMorganKaufmannpublications,visitourWebsite atwww.mkp.comorwww.books.elsevier.com. PrintedintheUnitedStatesofAmerica 10 09 08 07 06 5 4 3 2 1 Trademarks Thefollowingtrademarks,mentionedinthisbookandtheaccompanyingCD-ROM, arethepropertyofthefollowingorganizations: AltiVecisatrademarkofFreescaleSemiconductor. DirectX, Direct3D, VisualC++, Windows, Xbox, andXbox360aretrademarks ofMicrosoftCorporation. GameCubeisatrademarkofNintendo. GeForce,RivaTNT,andtheCgLanguagearetrademarksofNVIDIACorpora- tion. Java3DisatrademarkofSunMicrosystems. MacintoshisatrademarkofAppleCorporation. MorrowindandTheElderScrollsaretrademarksofBethesdaSoftworks,LLC. NetImmerseandGamebryoaretrademarksofEmergentGameTechnologies. OpenGLisatrademarkofSiliconGraphics,Inc. PentiumandStreamingSIMDExtensions(SSE)aretrademarksofIntelCorpo- ration. PhysXisatrademarkofAgeiaTechnologies,Inc. Playstation2andPlaystation3aretrademarksofSonyCorporation. PowerPCisatrademarkofIBM. PrinceofPersia3DisatrademarkofBrøderbundSoftware,Inc. 3DNow!isatrademarkofAdvancedMicroDevices. 3DStudioMaxisatrademarkofAutodesk,Inc. v About the Author DaveEberly is the president of Geometric Tools, Inc. (www.geometrictools.com), a company that specializes in software development for computer graphics, image analysis, and numerical methods. Previously, he was the director of engineering at NumericalDesignLtd.(NDL),thecompanyresponsibleforthereal-time3Dgame engine, NetImmerse. He also worked for NDL on Gamebryo, which was the next- generationengineafterNetImmerse.HisbackgroundincludesaBAdegreeinmath- ematicsfromBloomsburgUniversity,MSandPhDdegreesinmathematicsfromthe University of Colorado at Boulder, and MS and PhD degrees in computer science from the University of North Carolina at Chapel Hill. He is the author of Game Physics (2004) and 3D Game Engine Architecture (2005) and coauthor with Philip SchneiderofGeometricToolsforComputerGraphics(2003),allpublishedbyMorgan Kaufmann.Asamathematician, Davedidresearchinthemathematicsofcombus- tion, signal and image processing, and length-biased distributions in statistics. He wasanassociateprofessorattheUniversityofTexasatSanAntoniowithanadjunct appointmentinradiologyattheU.T.HealthScienceCenteratSanAntonio.In1991, he gave up his tenured position to retrain in computer science at the University of North Carolina. After graduating in 1994, he remained for one year as a research associate professor in computer science with a joint appointment in the Depart- mentofNeurosurgery,workinginmedicalimageanalysis.HisnextstopwastheSAS Institute, working for a year on SAS/Insight, a statistical graphics package. Finally, deciding that computer graphics and geometry were his real calling, Dave went to workforNDL(whichisnowEmergentGameTechnologies),thentoMagicSoftware, Inc.,whichlaterbecameGeometricTools,Inc.Dave’sparticipationinthenewsgroup comp.graphics.algorithmsandhisdesiretomake3Dgraphicstechnologyavailableto allarewhathasledtothecreationofhiscompany’sWebsiteandhisbooks. vi CCCCOOOONNNNTTTTEEEENNNNTTTTSSSS PPPPrrrreeeeffffaaaacccceeee........................................................................................................................................................................................................................................................xxxxxxxxiiii 1111 IIIInnnnttttrrrroooodddduuuuccccttttiiiioooonnnn........................................................................................................................................................................................................................1111 o 1.1The Evolution ofGraphics Hardware and Games o 1.2The Evolution ofThisBook and ItsSoftware o 1.3ASummary of the Chapters 2222 TTTThhhheeee GGGGrrrraaaapppphhhhiiiiccccssss SSSSyyyysssstttteeeemmmm............................................................................................................................................................7777 o 2.1The Foundation 2.1.1 Coordinate Systems � 2.1.2 Handednessand Cross Products � 2.1.3 Pointsand Vectors � o 2.2Transformations 2.2.1 LinearTransformations � 2.2.2Affine Transformations � vii 2.2.3 Projective Transformations � 2.2.4 Properties ofPerspective Projection � 2.2.5 Homogeneous Points and Matrices � o 2.3Cameras 2.3.1ThePerspective Camera Model � 2.3.2 Model orObject Space � 2.3.3World Space � 2.3.4View,Camera, orEye Space � 2.3.5 Clip,Projection, orHomogeneous Space � 2.3.6Window Space � 2.3.7 PuttingThemAll Together � o 2.4Culling and Clipping 2.4.1 Object Culling � 2.4.2 Back Face Culling � 2.4.3 Clipping to the ViewFrustum � o 2.5Rasterizing 2.5.1 Line Segments � 2.5.2 Circles � 2.5.3 Ellipses � 2.5.4Triangles � o 2.6VertexAttributes 2.6.1 Colors � 2.6.2 Lighting andMaterials � 2.6.3Textures � viii 2.6.4Transparency and Opacity � 2.6.5 Fog � 2.6.6And Many More � 2.6.7 RasterizingAttributes � o 2.7Issues of Software, Hardware, andAPIs 2.7.1AGeneral Discussion � 2.7.2 Portability versus Performance � o 2.8APIConventions 2.8.1 Matrix Representation and Storage � 2.8.2 Matrix Composition � 2.8.3View Matrices � 2.8.4 Projection Matrices � 2.8.5Window Handedness � 2.8.6 Rotations � 2.8.7 Fast Computations using the GraphicsAPI � 3333 RRRReeeennnnddddeeeerrrreeeerrrrssss........................................................................................................................................................................................................................111144447777 o 3.1Software Rendering o 3.2Hardware Rendering o 3.3The Fixed-Function Pipeline o 3.4Vertex andPixel Shaders o 3.5AnAbstract RenderingAPI ix 4444 SSSSppppeeeecccciiiiaaaallll EEEEffffffffeeeeccccttttssss UUUUssssiiiinnnngggg SSSShhhhaaaaddddeeeerrrrssss....................................................................................222211117777 o 4.1Vertex Colors o 4.2Lighting and Materials o 4.3Textures o 4.4Multitextures o 4.5Bump Maps o 4.6Gloss Maps o 4.7Sphere Maps o 4.8Cube Maps o 4.9Refraction o 4.10Planar Reflection o 4.11Planar Shadows o 4.12ProjectedTextures o 4.13ShadowMaps o 4.14Volumetric Fog o 4.15Skinning o 4.16Miscellaneous 4.16.1 Iridescence � 4.16.2Water Effects � 4.16.3Volumetric Textures � x 5555 SSSScccceeeennnneeee GGGGrrrraaaapppphhhhssss................................................................................................................................................................................................333311115555 o 5.1The Need forHigh-Level Data Management o 5.2The Need forLow-Level Data Structures o 5.3Geometric State 5.3.1Vertices and VertexAttributes � 5.3.2Transformations � 5.3.3 BoundingVolumes � o 5.4Render State 5.4.1 Global State � 5.4.2 Lights � 5.4.3 Effects � o 5.5The Update Pass 5.5.1 Geometric State Updates � 5.5.2 Render State Updates � o 5.6The Culling Pass 5.6.1 Hierarchical Culling � 5.6.2 Sorted Culling � o 5.7The Drawing Pass 5.7.1 Single-PassDrawing � 5.7.2 Single Effect, MultipassDrawing � 5.7.3 Multiple Effect, Multipass Drawing � 5.7.4 Caching Data on the Graphics Hardware � 5.7.5 Sorting toReduce State Changes � xi

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.