90 likes | 269 Views
CS662 Computer Graphics Game Technologies. Jim X. Chen, Ph.D. Computer Science Department George Mason University. Contents. Tentative Alan Watt and Fabio Policarpo, Advanced Game Development with Programmable Graphics Hardware Games we are interested in implementing Technical approaches
E N D
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University
Contents • Tentative • Alan Watt and Fabio Policarpo, Advanced Game Development with Programmable Graphics Hardware • Games we are interested in implementing • Technical approaches • Survey and presentation
Introduction and Cg Programming • The Hardware Model (Fig. 1.1, P3) • GPUs are highly programmable • They can carry out general computation • NVIDIA’s Cg, OpenGL 2.0’ Shading Language (GLSL), and DirectX 9’s High Level Shading Language (HLSL) – they are similar • “Shader” signifies a vertex, or a pixel or both together • The output of fragment program is a value for a pixel
The Hardware Model • GPU programming involves a vertex program and/or a fragment program. • Cg is not application specific, may be used for parallel computing, for example. • GPGPU – general purpose computation on GPU.
The Hardware Model • Vertex processor • Transformation, primitive assembly (lines, polygons), clipping, rasterization resulting in a set of pixel locations and fragments • A fragment is a potential pixel • Fragment processor • Fragment operations such as texture mapping. Result imy be a color (framebuffer) and a value (z-buffer) • Example: Gouraud shading and Phong shading • Gouraud shading needs vertex processor to calculate lighting at a vertex • Phong shading needs a fragment processor to calculate lighting at a pixel
Programming Overview • The Programming Model (Fig. 1.2, P6) • Data is streamed into the processor and operated on by a kernel function (fragment program) • Up to 16 arithmetic processors operate on the stream, and each data element is processed in parallel • There is no dependencies between elements • A shader is written to operate on a single vertex or fragment and is executed on every vertex or fragment
The Programming Model • Parallelism works in rendering and related applications that have no communication between processes • GPU fragment programs reads from texture maps and write to the framebuffer • May need to copy the results from the framebuffer back to texture maps. • Hardware limits are expressed by profiles