Emerging Technologies for Games Capability Testing and DirectX10 Features CO3301 Week 6.

Slides:



Advertisements
Similar presentations
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © 1/16 Deferred Lighting Deferred Lighting – 11/18/2014.
Advertisements

Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
CS 4363/6353 BASIC RENDERING. THE GRAPHICS PIPELINE OVERVIEW Vertex Processing Coordinate transformations Compute color for each vertex Clipping and Primitive.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Real-Time Rendering TEXTURING Lecture 02 Marina Gavrilova.
Introduction to Geometry Shaders Patrick Cozzi Analytical Graphics, Inc.
Status – Week 277 Victor Moya.
GPU Graphics Processing Unit. Graphics Pipeline Scene Transformations Lighting & Shading ViewingTransformations Rasterization GPUs evolved as hardware.
GEOMETRY SHADER. Breakdown  Basics  Review – graphics pipeline and shaders  What can the geometry shader do?  Working with the geometry shader  GLSL.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Beyond Meshes Spring 2012.
SET09115 Intro Graphics Programming
Computer Graphics Introducing DirectX
High Performance in Broad Reach Games Chas. Boyd
Shadows Computer Graphics. Shadows Shadows Extended light sources produce penumbras In real-time, we only use point light sources –Extended light sources.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
Computer Graphics Graphics Hardware
4.7. I NSTANCING Introduction to geometry instancing.
Geometric Objects and Transformations. Coordinate systems rial.html.
Computer Graphics Texture Mapping
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Chris Kerkhoff Matthew Sullivan 10/16/2009.  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a.
Week 11 - Thursday.  What did we talk about last time?  Image processing  Blurring  Edge detection  Color correction  Tone mapping  Lens flare.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Textures.
09/09/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Event management Lag Group assignment has happened, like it or not.
TERRAIN SET09115 Intro to Graphics Programming. Breakdown  Basics  What do we mean by terrain?  How terrain rendering works  Generating terrain 
CS 450: COMPUTER GRAPHICS REVIEW: INTRODUCTION TO COMPUTER GRAPHICS – PART 2 SPRING 2015 DR. MICHAEL J. REALE.
Advanced Computer Graphics Depth & Stencil Buffers / Rendering to Textures CO2409 Computer Graphics Week 19.
Emerging Technologies for Games Alpha Sorting and “Soft” Particles CO3303 Week 15.
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
Maths & Technologies for Games DirectX 11 – New Features Tessellation & Displacement Mapping CO3303 Week 19.
Shader Study 이동현. Vision engine   Games Helldorado The Show Warlord.
Computer Graphics Basic 3D Geometry CO2409 Computer Graphics Week 5-1.
Advanced Computer Graphics Shadow Techniques CO2409 Computer Graphics Week 20.
09/16/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Environment mapping Light mapping Project Goals for Stage 1.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Emerging Technologies for Games Deferred Rendering CO3303 Week 22.
Computer Graphics Blending CO2409 Computer Graphics Week 14.
Sky Boxes and Vector Math 2 Course Information CVG: Programming 4 My Name: Mark Walsh Website:
Graphics Graphics Korea University cgvr.korea.ac.kr 1 7. Speed-up Techniques Presented by SooKyun Kim.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Maths & Technologies for Games Graphics Optimisation - Batching CO3303 Week 5.
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
Computer Graphics Matrices
Particles and their home in Geometry Shaders Paul Taylor 2010.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
How to use a Pixel Shader CMT3317. Pixel shaders There is NO requirement to use a pixel shader for the coursework though you can if you want to You should.
Computer Graphics Graphics Hardware
- Introduction - Graphics Pipeline
Week 7 - Monday CS361.
Computer Graphics Index Buffers
Graphics Processing Unit
Deferred Lighting.
Chapter 6 GPU, Shaders, and Shading Languages
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Graphics Processing Unit
Introduction to geometry instancing
Lecture 13 Clipping & Scan Conversion
1.1 The Characteristics of Contemporary Processors, Input, Output and Storage Devices Types of Processors.
RADEON™ 9700 Architecture and 3D Performance
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
03 | Creating, Texturing and Moving Objects
Computer Graphics Introducing DirectX
Emerging Technologies for Games Review & Revision Strategy
Presentation transcript:

Emerging Technologies for Games Capability Testing and DirectX10 Features CO3301 Week 6

Today’s Lecture 1.Hardware Capabilities 2.Techniques and Capabilities 3.Geometry Shader Stage 4.Stream Output Stage 5.DirectX Resources

Hardware Capabilities All lab material so far has made assumptions about graphics capabilities Real world applications should not do this Sometimes need to query the system capabilities: –At least ensure minimum spec is met Adapt to machines of different power: –Enhancements available for high-end hardware –“Degrade gracefully” for lower spec machines Also optimise data for abilities of given system

Typical Capabilities Some key graphics capabilities: –Available screen resolutions, refresh rates –Depth and stencil buffer formats / bits per pixel –Anti-aliasing abilities (FSAA / MSAA) –Texture capabilities: Minimum / maximum size Pixel formats Render-target / cube map / instancing etc. support –Etc. Many render states also have capabilities to indicate the extent of their availability –E.g. Level of anisotropic filtering

Testing Capabilities Earlier DirectX versions needed intricate capability testing –Backwards compatibility meant that you didn’t know if you were running on legacy hardware, a problem for games However, DirectX10 and above define a minimum spec –Makes capability testing easier –No need to detect / support legacy hardware Still need some testing to check for advanced features Consoles are largely unaffected by such matters –Specification is fixed Still need to check for: –Hard drive size, HDTV resolutions, peripherals (controllers, cameras, etc.)

Shaders Revisited Shaders have been a central topic of the course –The most important area of modern graphics Shaders also have capabilities… –Shader hardware version Shaders compiled to machine code Shader version defines the instruction set available Higher shader versions have more instructions, e.g. for & if statements, and higher level functions They also have more registers –Number of instructions in a shader, depth of nesting etc. Should provide alternative shaders: –For high and low spec machines

Multiple Passes Complex materials need several rendering passes –i.e. render the same polygons multiple times –Each time with a different render state/shader –Each pass blended with the ones below Example: Earth shader used in some labs: –Pass 1: Render Earth surface – diffuse lighting, texture changes between night and day based on light level –Pass 2: Render clouds – diffuse lighting, moving UVs, blue tint at a glancing angle, alpha blend with Earth –Pass 3: Render outer atmosphere - inside out (reverse culling), exaggerated diffuse lighting, alpha blend - less alpha (i.e. more transparent) at glancing angle

Effects Files for Capabilities If any one pass in a technique fails capability testing, then degrade to a simpler technique The DirectX effects file system makes this quite simple Using effects files (.fx) files we can collect together shader passes and their render states into techniques Provide a range of techniques for different hardware specifications

Effect File Example // First technique – two passes technique EarthWithSpecular { pass P0 { SetVertexShader( CompileShader( vs_5_0, Earth1VS() )); SetGeometryShader( CompileShader( gs_5_0, Earth1GS() ) ); SetPixelShader( CompileShader( ps_5_0, Earth1PS() )); } pass P1 { SetVertexShader( CompileShader( vs_5_0, Clouds1VS() )); } } // Second simpler technique – different shaders, one pass technique EarthSimple { pass P0 { SetVertexShader( CompileShader( vs_4_0, Earth2VS() )); SetGeometryShader( NULL ); SetPixelShader( CompileShader( ps_4_0, Earth2PS() )); } }

DirectX 10 Pipeline Looked at most of the DirectX 10 pipeline in Computer Graphics However, we didn’t focus on some of the key new features of DX10: –Geometry Shader Stage Shaders to manipulate primitives rather than vertices or pixels –Stream-Output Stage Send data back to GPU memory –Unified access to memory resources at all stages Memory can be reinterpreted

Geometry Shaders The new geometry shader stage processes primitives –Triangles or lines Practically a geometry shader is much like a vertex shader, but working on multiple vertices at once –All three vertices of a triangle, or both points of a line –Allows techniques that can’t be done with only a single vertex E.g. calculate a face normal (cross product of the triangle edges) It operates on the output of the vertex shader –This is slightly counter-intuitive Would expect to start at highest level and work down –Raises questions: which shader does the matrix transformations? The geometry shader can also create or delete primitives –i.e. The output geometry can be different to the input

Geometry Input / Output The geometry shader input is an array of vertices –The number depends on the primitive type used E.g. 3 for triangles, 2 for lines Geometry shader output is a stream of primitives –The stream type must be specified: E.g. Triangles, lines etc. But always output as a strip, not a list –The output stream doesn’t need to match the input E.g. Could input triangles, but output lines (make a silhouette) Or input points and output triangles (particle system) Can output any number of primitives (including 0) –Allows the generation / deletion of primitives

Geometry Shader Example Example of geometry shader function header: struct GS_VertIn {... }; // Input vertex data (pos, normal, etc.) struct GS_VertOut {... }; // Output vertex data (may be different) [maxvertexcount(6)] // Maximum number of output vertices (depends void MakeWireframe // on technique used in shader code) ( // Input array of 3 vertices (i.e. model data is triangles) triangle GS_VertIn inVerts[3], // Output of shader is a stream of vertices paired into lines inout LineStream outStrip ) { // Example code on next slide }

Geometry Shader Example Example of geometry shader code: // Output outline of triangle (i.e. wireframe) outStrip.Append( inVerts[0] );// Add vertex to output stream outStrip.Append( inVerts[1] );// Another vertex to output a line outStrip.RestartStrip(); // End of line strip, start new one outStrip.Append( inVerts[1] ); // Second line… outStrip.Append( inVerts[2] ); outStrip.RestartStrip(); outStrip.Append( inVerts[2] ); // Third line… outStrip.Append( inVerts[0] ); outStrip.RestartStrip(); // Effectively outputting a line list here to illustrate methods // Would be better in this case to output a single line strip

Primitive Types / Adjacency List of possible input primitives Some types include adjacency information E.g. Look at triangle list with adjacency on diagram –Each triangle specified with six vertices –The 3 in the triangle, and the 3 adjacent to it in the model Allows more advanced techniques –E.g. Silhouettes –Note: adjacency data must be pre- calculated for model (not automatic)

Geometry Shader Uses Geometry shaders have a wide range of uses: –Distorting or animating geometry, especially using face normals Face normals cannot be calculated in vertex shaders –Silhouettes using adjacency data If one triangle faces camera (use face normal), but adjacent one faces away, then the edge between is a silhouette edge –Creating extra view-dependent geometry Tesselation of edge on geometry for smoother silhouettes Create “fins” for fur rendering (see later lab) –Particle systems without instancing: Input a point list, or a line list. Generate particle geometry in shader – generate a quad for each point / line More efficient than instancing –And many more, new ideas emerging all the time…

Geometry Shader Considerations Geometry shaders are not needed for “traditional” geometry rendering methods –Static models, lit with standard lighting approaches –Set geometry shader to “NULL” Performance of geometry shaders can be an issue: –Older DirectX 10 GPU’s are not efficient at generating large amounts of new geometry –So certain techniques, e.g. tessellation, are possible with geometry shaders, but not appropriate (see later lecture on tesselation) –Newer hardware is getting better, but this is a area where fall-back methods may be appropriate

The Stream Output Stage The data output from the geometry shader can be written back into GPU memory A very powerful new feature: –Allows the GPU to perform general purpose processing (GPGPU) E.g. A particle system can be done in two passes on the GPU: –Pass 1: Render with GPU as normal –Pass 2: Update particle positions on GPU, writing back to memory –No CPU intervention – efficient Esp. with geometry shader “instancing”

Stream Output Considerations Stream-Output cannot output to the same buffer that is being input from –However, this is usually what we want to do Work around this by using double buffering –Create two identical buffers of data –Input from one, and output to the other –Swap the buffers between frames Often need multiple passes to render / update geometry –Some vertex data may be needed for only one or the other pass –I.e. Likely to be some data redundancy –Example in GPU particle system lab later

Resources in DirectX 10 One of the most important changes in DirectX 10 and above is the generalisation of resources DirectX10 considers all kinds of buffer / texture as different kinds of "resource" A "resource" is simply a block of memory interpreted a particular way –Very flexibile: may reinterpret areas of GPU memory –E.g. Reinterpret a texture as a depth buffer (useful) Means changes to setup of textures and buffers –Although the concepts are unchanged There is a new resource type - constant buffers –Replaces constant tables to access shader constants