3D游戏编程概述.pdf
Survey of 3D Games Yanci Zhang Game Programming IIGame Programming II Hardware and software in 3D games Software What is game engine?History of game engine Fancy techniques in modern games Hardware History of graphics card Game Programming IIGame Programming II Outline Console games-Online games-Mobile games Domestic gross output value of game industry in 2009 Online games:25.6 billion(triple to 60 billion by 2014)Mobile games:0.6 billion Console games:?Billion Too many adverse factors in China(pirated edition,expensive graphics hardware,lack of fun of fighting with real person)Game Programming IIGame Programming II Game Market Game platform PC,PlayStation,XBox,Wii,ceil phone,tablet Core hardware:graphics processor Graphics processor vendor:nVidia,AMD,Intel Software Core software:game engine Core techniques:graphics,AI,network,multi-thread/core,physics Game Programming IIGame Programming II Hardware&Software Graphics hardware:nVidia vs.ATI Graphics API:OpenGL vs.DirectX Rendering engine:Quake,Unreal,CryEngine Physical engine:Havok vs.PhysX Game platform:PC,XBox,Play Station,Wii Game Programming IIGame Programming II Competitors in Game Industry Middleware Provide a suite of visual development tools in addition to reusable software components Integrated development environment Enable simplified,rapid development of games in data-driven manner Designed with component-based architecture Rendering engine,physics engine,sound,animation,AI,networking,memory management,threading,scene graph Game Programming IIGame Programming II 3D Game Engines Space Rogue/Ultima Underworld(1990)Using texture mapping Running on 386-based PC Game Programming IIGame Programming II History 1/14 Doom(1993)Not a true 3D engine Using 2D sprites representing objects Game Programming IIGame Programming II History 2/14 XnGine(1995)One of the first 3D engines Game Programming IIGame Programming II History 3/14 Quake(1996)Utilizing z-buffer technique Including 3D light sources Supporting 3D hardware acceleration Game Programming IIGame Programming II History 4/14 Renderware(1996)Employed in over 200 games(PS2,PS3,PSP,PC,Wii,XBox)Allowing developers to manipulate art and game processes in real time Game Programming IIGame Programming II History 5/14 Quake II(1997)Offering native OpenGL support Allowing for both software and OpenGL renders Moddability Game Programming IIGame Programming II History 6/14 GoldSRC(1998)Tweaked Quake engine Supporting both OpenGL and DirectX Game Programming IIGame Programming II History 7/14 Unreal(1998)Main competitor to Quake II Having its own scripting language,map editor,modification program Game Programming IIGame Programming II History 8/14 Quake III(1999)Providing smother animation by per-vertex animation Better shadow effects Game Programming IIGame Programming II History 9/14 GeoMod(2001)Changing world geometry in response to whats going on Precursor of realistic in-game physics Game Programming IIGame Programming II History 10/14 Unreal 2(2002)Adding integrated physics Adding 64-bit support Introducing improved special effects Game Programming IIGame Programming II History 11/14 Doom 3(2004)Switch from C to C+Key features:unified lighting and shadowing Game Programming IIGame Programming II History 12/14 CryEngine(2004)A shader heavy engine Game Programming IIGame Programming II History 13/14 Unreal 3(2007)Based on DirectX 10 Using middleware technologies,including multi-threaded rendering system,64-bit HDR rendering pipeline,skeletal animation system Game Programming IIGame Programming II History 14/14 Realistic(not only rendering quality,but also physical interaction)Real-time(not an issue in film industry)Hardware development never meets the requirement of realistic rendering Game Programming IIGame Programming II Goals of 3D Games Game before 1996:CPU in charge of all computations The first 3D acceleration card:Voodoo Start new ear of high-performance and high-quality 3D graphics for gaming GPU:proposed by nVidia GeForce 256 Introducing hardware transformation and lighting GPU in charge of graphics computation PPU:proposed by Ageia PPU in charge of physical computation Ageia is took over by nVidia PPU is merged to GPU Future:CPU and GPU merged together?APU?Game Programming IIGame Programming II Evolution of Techniques Second revolution in visual computing:Make it real!Manipulate objects in a real way Objects interact with environment in a real way Game Programming IIGame Programming II Physics Simulation 1.No physics 2.Gravity 3.Gravity+collision detection 4.Gravity+collision detection+rotation calculations Provides approximate simulation of certain physical systems Real-time vs.high-precision Prefer perceptually correct approximation than real simulation Game Programming IIGame Programming II Physics Engine Physics simulation was adopted in games for years Havok Founded in 1998 The main solution provider for physics simulation All physics computations are done by CPU Dominant but low profile CPU is the bottleneck Game Programming IIGame Programming II Early Years:Havok Challenger appeared in 2005 AGEIA announced Physics Processing Unit(PPU)chip and PhysX SDK Game Programming IIGame Programming II Challenger:AGEIA Capable of performing game physics calculation much faster than CPU The first hardware designed to offload physics calculation from CPU to a separate chip Game Programming IIGame Programming II PPU Havok FX was announced Why bought PPU?A GPU-based physics engine nVidia,ATI built cooperation with Havok Two graphics card,one for graphics computations,the other for physics computations Game Programming IIGame Programming II Fight Back from Havok Havok was bought by Intel in Sep.2007 Intel is not a fan of GPU computing Stop developing Havok FX nVidia,ATI Game Programming IIGame Programming II Intel:Pissed Off The advantages of Ageia PhysX SDK is free Earn lots of favorable comments after Havok was bought nVidia acquired Ageia in 2008 Target was PhysX SDK instead of PPU Rewrote PhysX SDK by CUDA in one month Graphics and physics computations are executed on a single GPU Well supported by lots of games Game Programming IIGame Programming II Born of nVidia PhysX ATI Lee Ka Lau,Benny Lau,and Kwok Yuen Ho(何国源)founded ATI in 1985 nVidia Jen-Hsun Huang(黄仁勋),Chris Malachowsky,Curtis Priem founded nVidia in 1993 Game Programming IIGame Programming II Origin of nVidia and ATI IBM PC introduced on August 12,1981 CGA:Color Graphics Adapter First color computer display standard for IBM PC 16K video memory Featured several graphics and text modes Highest resolution was 640*200 16 colors Game Programming IIGame Programming II Long Long Ago Enhanced Graphics Adapter(EGA)Introduced in October 1984 Produces a display of 16 simultaneous colors from a palette of 64 up to 640350 pixels.Game Programming IIGame Programming II Enhanced Graphics Adapter Video Graphics Array(VGA)Introduced with IBM PS/2 in 1987 256K video RAM Different meanings now due to its widespread adoption Analog computer display standard 640480 resolution itself Game Programming IIGame Programming II Video Graphics Array Lee Ka Lau,Benny Lau,and Kwok Yuen Ho(何国源何国源)founded ATI(Array Technology Industry)in 1985 Worked primarily in the OEM field,producing integrated graphics cards 1987-1994 Introduced EGA Wonder and VGA Wonder graphics card product lines under its brand in 1987 Released other three generations of 2D graphics card:Mach8(1991),Mach32(1992),Mach64(1994)Went public in 1993 Game Programming IIGame Programming II Early Years of ATI No independent market of graphics chips Graphics chips were integrated with audio chips Jen-Hsun Huang(黄仁勋黄仁勋),Chris Malachowsky,Curtis Priem co-founded nVidia in 1993 Ross Smith,Gary Tarolli and Scott Sellers founded 3dfx in 1994 Game Programming IIGame Programming II 1993&1994 nVidia released NV1 Featured a complete 2D/3D graphics core based upon Quadratic Texture Mapping(QTM)Integrated graphics,audio and joystick Credible 3D performances,but high-cost and poor overall quality Game Programming IIGame Programming II 1995:NV1 1/2 Things got worse Microsoft announced Windows95 and DirectX DirectX was generally incompatible with NV1 Support from SEGA Game Programming IIGame Programming II 1995:NV1 2/2 3dfx released Voodoo Graphics chip ATI released its first 3D graphics card:3D Rage nVidia announced supporting Microsoft Direct3D API Microsoft wanted to contain 3dfx Change technological direction from console to PC Game Programming IIGame Programming II 1996 nVidia released NV3(RIVA 128)One of the first consumer graphics processing units to integrate 3D,2D and video acceleration The first product gaining widespread recognition Designed to accelerate Direct3D to the utmost extent possible One of the first card could rival Voodoo Game Programming IIGame Programming II 1997 3dfx released Voodoo2 Three graphics processing units on a single chipset The only 3D card capable of single-cycle dual-texturing Most games supported 3dfxs proprietary Glide API which gave Voodoo2 a large advantage in speed and image quality Introduced Scan-Line Interleave(SLI)Not only doubled rendering throughput,also increased total framebuffer memory Game Programming IIGame Programming II 1998 1/2 nVidia released NV4(RIVA TNT)Response to Voodoo2 Cemented nNidias reputation as a worthy rival within 3D graphics adapter industry Came close to Voodoo2 in performance in some games,and beaten it in 32bit image quality Very successful drivers Game Programming IIGame Programming II 1998 2/2 3dfx released Voodoo3 Purchased STB Technologies Indented to start manufacturing,marketing and selling its own graphics cards,rather than functioning only as OEM supplier Vastly different entities,never integrated smoothly One of the main contributors to downfall Expect to make 3dfx the undisputed leader but below expectation Lacked 32-bit color and large texture support Gave up market leadership to nVidia Game Programming IIGame Programming II 1999 1/2 nVidia released RIVA TNT2(NV5)AGP 4X,32M VRAM,0.25m Clock speeds improved from 90MHz to 150+MHz Support 32-bit color and 2048*2048 texture Game Programming IIGame Programming II 1999 2/2 nVidia released GeForce 256 The original release in“GeForce”product-line Worlds first GPU(Graphics Processing Unit)Transform and Lighting(T&L)engine Integrating T&L into GPU itself Reducing hardware complexity and price consequently Industry-leading real-time 3D rendering performance Allowing nVidia entering CAD market with product named“Quadro”The first fully Direct3D 7-compliant 3D accelerator Game Programming IIGame Programming II 1999 nVidia acquired 3dfx nVidia released Geforce2(NV15)Built on a 180 nm manufacturing process Add a second texture mapping unit to each pixel pipeline Introduce NVIDIA Shading Rasterizer(NSR)Game Programming IIGame Programming II 2000 1/2 ATI released Radeon R100 The first generation of Radeon graphics chips Support Direct3D 7.0 and OpenGL 1.3 Hardware T&L engine Also include 2D GUI acceleration,video acceleration and multiple display output Game Programming IIGame Programming II 2000 2/2 nVidia released GeForce3(NV20)Advanced the GeForce architecture by adding programmable pixel and vertex shaders multi-sampling full-scene anti-aliasing The first Direct3D 8.0 compliant 3D card Quadro DCC for computer aided design NV2A adopted by Microsoft XBox Game Programming IIGame Programming II 2001 1/2 ATI released Radeon R200 Support Direct3D 8.0 and OpenGL 1.3 Radeon 8500 was able to outperform GeForce 3 Game Programming IIGame Programming II 2001 2/2 Conflicts between Microsoft and nVidia nVidia denied to decrease GPU price for Xbox Microsoft gave GPU order of its next generation of Xbox to ATI Intel supported ATI to compete with nVidia Microsoft+Intel+ATI vs.nVidia Share price of nVidia dropped from$70 to$7 nVidia released GeForce4(NV17,NV18,NV19,NV25,NV28)Game Programming IIGame Programming II 2002 1/2 ATI released R300 The first fully Direct3D 9-capable consumer graphics chip The first board to take advantage of a 256-bit memory bus One of the greatest graphics card in history,alongside the achievements GeForce 256 and Voodoo Graphics Game Programming IIGame Programming II 2002 2/2 nVidia released GeForce FX Weak performance for processing Shader Model 2 programs The most failed product in nVidias history nVidia resolved issues with Microsoft nVidia started cooperation with Intel Game Programming IIGame Programming II 2003 1/2 nVidia released GeForce 6&7 series Introduced SLI technology Compliant with Direct 9.0c and Shader Model 3.0 Game Programming IIGame Programming II 2004-2006 1/2 1/2 ATI released R420&R520 Kwok Yuen Ho resigned as ATI CEO in face of OSC probe He and other ATI insiders,including his wife,Betty,are accused of avoiding losses of$7.9-million by selling company stock before a December,2000,Game Programming IIGame Programming II 2004-2006 2/2 nVidia released GeForce 8 The first fully Direct3D 10-capable consumer graphics chip Introduced first unified shader architecture Major shift for nVidia in GPU functionality and capability Introduced CUDA(Compute Unified Device Architecture)GPU evolved from graphics computation to general compuatation Game Programming IIGame Programming II 2006-2007 1/2 ATI released Radeon R600 Acquired by AMD in 2006$5.4 billion ATIs operations were folded into AMD Graphics Product Group ATIs position Preparing for the Inevitable Confrontation with Intel Competing with NVIDIA is Tough,this Makes it Easier The Manufacturing&Design Advantage AMDs position Merging CPU and GPU together to compete with Intel Game Programming IIGame Programming II 2006-2007 2/2 Intel announced its Larrabee GPU project Considered a hybrid between multi-core CPU and GPU CPU-like:coherent cache and x86 architecture GPU-like:wide SIMD vector units and texture sampling hardware Cancelled in 2010 Game Programming IIGame Programming II 2007