1 / 29

Advanced programming for 3D Graphics Applications

Advanced programming for 3D Graphics Applications. Console developement. Components of a Video Game. 3D graphics User interaction Sound effects and music 3D models 2D textures Animation Game and level design Immersion, excitement, alternate reality.

gil
Download Presentation

Advanced programming for 3D Graphics Applications

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Advanced programming for 3D Graphics Applications Console developement

  2. Components of a Video Game • 3D graphics • User interaction • Sound effects and music • 3D models • 2D textures • Animation • Game and level design • Immersion, excitement, alternate reality

  3. PlayStation Net Yaroze (1997)(Official “hobbyist” Game Development) • Host-target Development • Net Yaroze games dev libraries • No access to hardware • Sub-optimal Performance

  4. PlayStation2 Games Console European Launch: November 2000

  5. TV Controllers Linux Box LAN PC Professional Development EnvironmentThe TOOL • Use the Linux-based tools that come with the TOOL • Use third party dev tools such as CodeWarrior or SN systems

  6. PlayStation2 Linux Kit – May 2002 • USB keyboard & mouse • 10/100 Ethernet Adapter • 40GB Hard Disk • DVDs • Linux operating system • Hardware Manuals • Development Tools • Example Applications

  7. Graphics Transformation Pipeline • Transforms vertices from model or local space to 2D screen space for rasterisation

  8. PS2 Graphics Architecture

  9. PS2 Specific Pipeline • Transformation Matrices built by CPU • Matrices and untransformed vertex data sent to VU1 • VU1 performs vertex transformation, clipping, lighting, view port scaling. • Transformed data sent to GS. • GS performs texturing and rasterisation. • All above (3 processes) can run in parallel !!

  10. Organisation of Memory • Dynamic buffer contains data that changes from frame to frame, e.g. transformed data, transformation matrices. • Two dynamic buffers needed to exploit parallelism of PS2 • One buffer is being compiled by the CPU whilst the other is being sent for rendering. • Utilises Parallelism of PS2 Swap Every Frame Written by CPU Read by DMAC

  11. The Game Loop while(Game_Running) { Fire(); // Start data transfer GetUserInput(); // DoGameLogic(); // AI, Physics, Logic…. // Following code ONLY puts render data into memory BeginScene(); // Clear frame buffer SetStaticData(); // textures, 3d models etc SetDynamicData(); // Matrices, T&L, etc. EndScene(); // Wait for previous frame to render }

  12. VU Overview

  13. Architecture of VU1 • 16k data memory, address in qwords (128-bit) • 16k program memory, address in dwords (64-bit) • 32 x 128-bit floating point registers • 16 x 16-bit integer registers (newbie killer!) • Two execution units (upper and lower) • Special registers (ACC, I, Q, R, P) • Dual stream assembly language (.vsm file) • VU assembler provided by Sony (ee-dvp-as) • Latency, scheduling, pairing, issues.

  14. Typical vsm assembly (dual stream) NOP lq VF06,7(VI02) mulax ACC,VF02,VF06x iaddiu VI01,VI01,0x00000001 madday ACC,VF03,VF06y iaddiu VI02,VI02,0x00000002 maddaz ACC,VF04,VF06z NOP maddw VF06,VF05,VF06w NOP NOP NOP NOP NOP NOP NOP mulaw.xyz ACC,VF01,VF00w div Q,VF00w,VF06w NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP mulq.xyz VF06,VF06,Q waitq NOP NOP NOP NOP NOP NOP

  15. Typical VCL(Single Stream) loop: lq Vert, StartVert(iVertPtr) MatrixMultiplyVertex Vert, fTransform, Vert div q, vf00[w], Vert[w] mul.xyz Vert, Vert, q mula.xyz acc, fScales, vf00[w] madd.xyz Vert, Vert, fScales ftoi4.xyz Vert, Vert

  16. Why is the PS2 used? • Introduce console development topics • 2D graphics, frame buffers, graphics packets, graphics processors, memory management, console architecture…. • 3D graphics, 3D console architecture, Vector Units, Parallel processing, vertex transformation, clipping, lighting. • C++ concepts in a games context, Sprite classes etc., structure of a games program, Low level vertex processing. • Creating a 3D game engine

  17. Development Configuration(Several Options) • Host/Target • Native

  18. Development Tools • GNU gcc and g++ compilers • GNU gdb debugger! • Vector Command Line Pre-processor • Vector Unit assembler • Visual Vector Unit Debugger • Development can be done “offline” with Visual Studio”

  19. Development Environment

  20. SPS2: Direct Access Environment • Developed by PS2Linux developer community • 1.What is it? • 2.Why use it? • 3.How do I use it? • 4.Are there disadvantages?

  21. What is SPS2? • •Kernel module loaded at runtime • •Gives direct access to the hardware • •Has been used to create samples requiring lots of processing power • •Linux friendly

  22. Advantages • Required for DMA transfers • –Guarantee to have unswappable/unmovable memory • •Only 4kb continuous memory is guarantied • –Physical address of memory • •You fill the buffers using Linux virtual addresses and sends the data using physical addresses • –Direct access to the hardware registers • •EE • •GS

  23. •DMA packet checker • –Set of functions for debugging purposes • –Helps prevent crashes • •Easy to crash the system • •Very good documentation • •Samples to illustrate usage • •Currently being developed and improved • •The module can be installed/uninstalled at runtime • –No need to recompile the kernel • –No memory is reserved • –No need to even reboot

  24. How to use SPS2 • •Load the kernel at runtime • –Scripts are provided to make it easy • •Use the library provided • –Just a set of headers to include • –System calls are taken care of • •Build DMA packets the same way you’d do on a DevKit • –Use memory allocated by the module • –Build small 4kb chunks linked in a chain • •Use macros to set the DMA registers • –Macros are assembly code writing directly to the registers

  25. SPS2 project framework • •Written by members of the community • –Professional developers • •Takes cares of display initialisation • •Deals with DMA packet building • •Provides a solid base for your code • •Samples of advanced techniques used in a game • –Mskpath3 • –Bump mapping • –Interlock

  26. Evaluation • Games Employers Value Console Skills • Steep learning curve for students • In-house development framework needed • Similarities to Pro-development • Motivational for students • Introduces Linux & Linux development tool chain

More Related