Advanced programming for 3d graphics applications
Download
1 / 29

Advanced programming for 3D Graphics Applications - PowerPoint PPT Presentation


  • 121 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Advanced programming for 3D Graphics Applications' - gil


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Components of a video game
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


Playstation net yaroze 1997 official hobbyist game development
PlayStation Net Yaroze (1997)(Official “hobbyist” Game Development)

  • Host-target Development

  • Net Yaroze games dev libraries

  • No access to hardware

  • Sub-optimal Performance


PlayStation2 Games Console

European Launch: November 2000


Professional development environment the tool

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


Playstation2 linux kit may 2002
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


Graphics transformation pipeline
Graphics Transformation Pipeline

  • Transforms vertices from model or local space to 2D screen space for rasterisation



Ps2 specific pipeline
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 !!


Organisation of memory
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


The game loop
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

}



Architecture of vu1
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.


Typical vsm assembly dual stream
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


Typical vcl single stream
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


Why is the ps2 used
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


Development configuration several options
Development Configuration(Several Options)

  • Host/Target

  • Native


Development tools
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”



Sps2 direct access environment
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?


What is sps2
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


Advantages
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


  • •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


How to use sps2
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


Sps2 project framework
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


Evaluation
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


ad