Advanced D3D10 Shader Authoring Presentation/Presenter Title Slide.

Slides:



Advertisements
Similar presentations
Perspective aperture ygyg yryr n zgzg y s = y g (n/z g ) ysys y s = y r (n/z r ) zrzr.
Advertisements

EViews Student Version. Today’s Workshop Basic grasp of how EViews manages data Creating Workfiles Importing data Running regressions Performing basic.
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
GLSL Basics Discussion Lecture for CS 418 Spring 2015 TA: Zhicheng Yan, Sushma S Kini, Mary Pietrowicz.
Understanding the graphics pipeline Lecture 2 Original Slides by: Suresh Venkatasubramanian Updates by Joseph Kider.
Status – Week 257 Victor Moya. Summary GPU interface. GPU interface. GPU state. GPU state. API/Driver State. API/Driver State. Driver/CPU Proxy. Driver/CPU.
The Programmable Graphics Hardware Pipeline Doug James Asst. Professor CS & Robotics.
Programming Basics Aims of Programming: –The aim of programming is to write programs to accomplish complex tasks Programming method: –functional decompositional.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics April 19, 2007.
Introduction to Shader Programming
A Crash Course on Programmable Graphics Hardware Li-Yi Wei 2005 at Tsinghua University, Beijing.
The programmable pipeline Lecture 10 Slide Courtesy to Dr. Suresh Venkatasubramanian.
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation. All.
Computer Science – Game DesignUC Santa Cruz Adapted from Jim Whitehead’s slides Shaders Feb 18, 2011 Creative Commons Attribution 3.0 (Except copyrighted.
High Performance in Broad Reach Games Chas. Boyd
GAM532 DPS932 – Week 1 Rendering Pipeline and Shaders.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
REAL-TIME VOLUME GRAPHICS Christof Rezk Salama Computer Graphics and Multimedia Group, University of Siegen, Germany Eurographics 2006 Real-Time Volume.
GPU Programming Robert Hero Quick Overview (The Old Way) Graphics cards process Triangles Graphics cards process Triangles Quads.
CHAPTER 4 Window Creation and Control © 2008 Cengage Learning EMEA.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Real-time Graphical Shader Programming with Cg (HLSL)
차세대 그래픽 개발 환경.NET & DirectX 강성재 Community Specialist Microsoft Corporation.
Geometric Objects and Transformations. Coordinate systems rial.html.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
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.
Overview [See Video file] Architecture Overview.
A Crash Course in HLSL Matt Christian.
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
1 Dr. Scott Schaefer Programmable Shaders. 2/30 Graphics Cards Performance Nvidia Geforce 6800 GTX 1  6.4 billion pixels/sec Nvidia Geforce 7900 GTX.
CSE 690: GPGPU Lecture 6: Cg Tutorial Klaus Mueller Computer Science, Stony Brook University.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
Shadow Mapping Chun-Fa Chang National Taiwan Normal University.
Term 2, 2011 Week 1. CONTENTS Problem-solving methodology Programming and scripting languages – Programming languages Programming languages – Scripting.
Creating Graphical User Interfaces (GUI’s) with MATLAB By Jeffrey A. Webb OSU Gateway Coalition Member.
GRAPHICS PIPELINE & SHADERS SET09115 Intro to Graphics Programming.
CS662 Computer Graphics Game Technologies Jim X. Chen, Ph.D. Computer Science Department George Mason University.
Ritual ™ Entertainment: Next-Gen Effects on Direct3D ® 10 Sam Z. Glassenberg Program Manager Microsoft ® – Direct3D ® Doug Service Director of Technology.
DEV330 Visual Studio.NET IDE Tips and Tricks Billy Hollis Author / consultant.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
NVIDIA FX Composer 2 Shader Authoring for Everyone Philippe Rollin Aravind Kalaiah.
CSE 381 – Advanced Game Programming GLSL. Rendering Revisited.
Computer Graphics 3 Lecture 6: Other Hardware-Based Extensions Benjamin Mora 1 University of Wales Swansea Dr. Benjamin Mora.
Ray Tracing using Programmable Graphics Hardware
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.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS The GPU.
Workflow in Microsoft Office SharePoint Server Jessica Gruber Consultant Microsoft Corporation.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
Computer Science – Game DesignUC Santa Cruz Tile Engine.
COMP 175 | COMPUTER GRAPHICS Remco Chang1/XX13 – GLSL Lecture 13: OpenGL Shading Language (GLSL) COMP 175: Computer Graphics April 12, 2016.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
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.
Dive Into® Visual Basic 2010 Express
Programmable Shaders Dr. Scott Schaefer.
A Crash Course on Programmable Graphics Hardware
Build /24/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Deferred Lighting.
Chapter 6 GPU, Shaders, and Shading Languages
A lap around DirectX game development tools
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
UMBC Graphics for Games
UMBC Graphics for Games
Chapter VI OpenGL ES and Shader
HW for Computer Graphics
Computer Graphics Introduction to Shaders
CIS 441/541: Introduction to Computer Graphics Lecture 15: shaders
03 | Creating, Texturing and Moving Objects
CS 480/680 Computer Graphics GLSL Overview.
Presentation transcript:

Advanced D3D10 Shader Authoring Presentation/Presenter Title Slide

Overview Review of Direct3D 10 and HLSL 4.0 The power of the programmable pipeline Guided exercises: Visualizer

Some New D3D10 Features Completely re-architected from D3D9 for configurability and performance Geometry Shader Fixed-function lighting and transformation now programmable in HLSL 4.0 Configurable pipeline Flexible shader signatures System-generated values

High Level Shader Language HLSL is a highly effective language for writing shaders Syntax is similar to ‘C’ Preprocessor defines (#define, #ifdef, etc) Basic types (float, int, uint, bool, etc) Operators, variables, functions Has some important differences Builtin variables (float4, matrix, etc) Intrinsic functions (mul, normalize, etc)

Overview of the Pipeline Triangles VertexShader Shader Constants Textures / Buffers Effect GeometryShader PixelShader

Vertex Shader 4.0 InputVertices Shader Constants System Variables ( VertexID ) Output It’s up to you now Color, Texture Coordinates, etc

System-generated Values Values usable in shaders generated by the D3D10 runtime Act exactly like semantics, just tag your variable and off you go SV_VertexID Provided to the VS SV_InstanceID SV_PrimitiveID Provided to the GS (or PS if there is no GS)

Geometry Shader 4.0 Input Per-primitive data (3 verts for a tri) System variables ( PrimitiveID ) Output Points, lines, triangles Render target index, clip distances Stream data to a buffer on the GPU aka stream out

Geometry Shader Restrictions Cannot output more than 4096 bytes of information for each input primitive Performance is not guaranteed when amplifying at this level

Pixel Shader 4.0 Input Interpolated data from vertex shader Output Pixel color (with alpha) Optional: depth

What This Means: Configurability The real power of Direct3D 10 is that there are many ways to accomplish any one task More and more tasks can be pushed onto the GPU Performance/quality tradeoff can be made on your terms

Guided Exercises: Visualizer DirectX 10 - exploitive effects in an audio visualizer Roughly based on the GPUSpectrogram sample in available in the DirectX SDK A framework to try out HLSL 4.0 plus to show: InstanceIDs Integer offset samplers Geometry amplification Debugging using PIX

Guided Exercises General Directions Each effect file guides you through the exercises. Breakdancin’ Bob shows up in the comments where there is something to learn or something to do. Use Visual Studio to edit the effect and cpp files and to build. If you get stuck or need help, raise your hand. A proctor will assist you.

The Basic Idea GPUSpectrogram uses the GPU to analyze the raw audio data and evaluate the levels of various frequency ranges To check this code out and see the new integer instruction set in action, check out the GPUSpectrogram sample or GPUSpectrogram.fx included in the workshop

Using Spectrogram Data We’ll be using shaders to take this data and make a visualizer Dancing bars with extra effects These techniques directly apply to game scenarios The configurability of the pipeline makes the possibilities endless

Exercise 1: Drawing the Bars Please open Exercise01.sln Hint: Bob’s hiding in Exercise01.fx

Exercise 1: Drawing the Bars Solution: input.Pos.y *= abs(spectrogram.r)*fScale*g_fScale;

Exercise 2: Performance We’ll be using PIX to do performance analysis 1.Build Exercise02.sln 2.Open PIX (Start->PIX for Windows) 3.File -> New Experiment 4.Navigate to your built exercise 5.Select “A replayable Direct3D call stream, saved to file:” 6.Enter a file name ending in “.PIXrun” 7.Click “Start Experiment”

Exercise 2: Performance When you exit the application, you’ll have a log of every D3D command that was executed We’ve created a perf event called “Draw Bars” that will help you find the actual draw calls for the bars. There is a small problem in how it’s rendering that’s causing a loss in performance… You might want to look in Exercise02.cpp

Exercise 2: Debugging

Exercise 2: Performance Solution: pd3dDevice->DrawIndexedInstanced( (UINT)pSubset->IndexCount, g_iNumInstances, 0, (UINT)pSubset->VertexStart, 0 );

Please open Exercise3.sln Hint: Bob’s hiding in Exercise3.fx Exercise 3: Geometry Amplification

Solution: TriStream.Append( output );

Exercise 4: More Performance We’ll be using PIX to see how we can tweak rendering parameters to maximize performance We’ve made a custom set of variables you can track in PIX so you can see the values of the sliders We’ll be seeing how changing these values changes framerate

Exercise 4: More Performance 1.Build Exercise04.sln 2.Open PIX (Start->PIX for Windows) 3.File -> New Experiment 4.Navigate to your built exercise 5.Click “More Options” 6.For CounterSet, select “(Custom)” 7.Add all counters under the “Pluging Counters” 8.Click “OK” 9.Click “Start Experiment”

Exercise 4: More Debugging

You can assign colored lines to each of the slider values along the bottom of the chat You can also set the framerate as a graphed line You can see the framerate has a direct correlation to many of these sliders (some more than others)

Exercise 5: Floor Effect Please open Exercise05.sln Hint: Bob’s hiding in Exercise05.fx

Exercise 5: Floor Effect Solution: tex.x += sin( input.Tex.y*40 )*0.001; tex.y += sin( input.Tex.y*60 )*0.001;

Exercise 6: Screen Effects Please open Exercise06.sln Hint: Bob’s hiding in Exercise06.fx

Exercise 6: Screen Effects Solution (One of many!): float2 tex = input.Tex.xy*2 - 1; float texMag = length( tex ); tex /= texMag; float shift = sin(texMag*50.0-g_fTime*3)*g_fElapsedTime*0.3; float2 offset = float2(tex.y*shift, -tex.x*shift ); tex *= texMag; tex += offset; tex = tex/ ; float4 color = BoxFilter( g_samLinearClamp, tex, 3 ); return color * 0.80;

© 2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. End Slide