Vertex and Pixel Shaders:

Size: px
Start display at page:

Download "Vertex and Pixel Shaders:"

Transcription

1 Vertex and Pixel Shaders: Making the world safe for Computer Graphics Adrian Perez : Computer Graphics 2 February 27 th, 2001

2 Administrivia Homework 1 will be handed back on Thursday Midterm is next Tuesday Review for midterm is this Thursday.

3 Talk Outline Motivation for vertex/pixel shaders Vertex Shaders Implementation in DX8 Examples Pixel Shaders Implementation in DX8 Examples Integration with other areas of DX8

4 But First holy war update Direct3D won. Get over it. OpenGL cannot accommodate the speed at which the graphics industry is moving now. All of the extentions to do things like vertex and pixel shading are vendor-specific. Direct3D stopped sucking a few versions ago anyway.

5 Transformation and Lighting The way D3D used to be was fixedfunction Unlit primitives (objectspace position/normal/material/uv s) Lit primitives (objectspace position/color/uv s) Transformed-and-lit primitives (screenspace position/color/uv s)

6 Transformation and Lighting The Good Provided a mechanism for people to roll their own T&L (back when everybody did so) The Bad Restrictive in function. You were bound to D3D s lighting model and transformation paradigm; not a terribly big deal for awhile

7 Transformation and Lighting Games these days want more control over the hardware Important because otherwise, every game is going through the same code path, making them look very similar Especially important since hardware is getting unfucking-believably fast Microsoft and nvidia realized that a more generic way for applications to perform transformation and lighting was needed

8 Enter Vertex Shaders A Vertex Shader is essentially assembly language for the T&L engine Subset of most ASM languages: no branching, for example If hardware T&L is available, the op-codes are just downloaded to the chip and run natively The op-codes are interpreted by a surprisingly fast software implementation if T&L hardware isn t available

9 Enter Vertex Shaders The Good Amazingly powerful You are not bound to provide it any specific data as input, as you are writing the handling code Much more precision everything is in floating point The Bad Hard to debug and grok We re right back in assembly hacking land

10 Vertex Shader Registers Input Registers Output Registers Name Count R/W Name Count R/W an 1 scalar W only odn 2 vectors W only c[n] 96 vectors R/W ofog 1 scalar W only rn 12 vectors R/W opos 1 vector W only vn 16 vectors R only opts 1 scalar W only otn 4 vectors W only

11 Vertex Shader Instructions add Sum dp3 Three-components dot-product dp4 Four-component dot-product dst Distance vector expp Exponential 10-bit precision lit Lighting coefficients logp Logarithm 10-bit precision mad Multiply and add max Maximum min Minimum mov Move mul Multiply rcp Reciprocal rsq Reciprocal square root sge Set on greater or equal than slt Set on less than sub Subtract def Define Constants vs Version and Type exp Exponential base2 full precis. frc Fraction log Logarithm base 2 full precision m3x2 3 2 vector matrix multiply m3x3 3 3 vector matrix multiply m3x4 3 4 vector matrix multiply m4x3 4 3 vector matrix multiply m4x4 4 4 vector matrix multiply

12 Vertex Shader Semantics Shaders are defined in a separate source file. They are compiled into bytecode (at runtime, if you wish) and then the bytecode can be loaded onto the card. When you render, you choose a vertex shader to use Fixed-function pipeline is still available (as a hard-coded vertex shader)

13 Vertex Shader Examples

14 Vertex Shader Examples #include "Constants.h" // v0 -- position // v1 -- normal // v2 -- tex coord vs.1.0 // compute world space position dp4 r1.x, v0, c[cv_world_0] dp4 r1.y, v0, c[cv_world_1] dp4 r1.z, v0, c[cv_world_2] dp4 r1.w, v0, c[cv_world_3] // transform position dp4 opos.x, v0, c[cv_worldviewproj_0] dp4 opos.y, v0, c[cv_worldviewproj_1] dp4 opos.z, v0, c[cv_worldviewproj_2] dp4 opos.w, v0, c[cv_worldviewproj_3] // transform normal dp3 r0.x, v1, c[cv_world_it_0] dp3 r0.y, v1, c[cv_world_it_1] dp3 r0.z, v1, c[cv_world_it_2] // vector from point to eye add r2, c[cv_eye], -r1 // normalize e dp3 r2.w, r2, r2 rsq r2.w, r2.w mul r2, r2, r2.w // e dot n dp3 ot1.x, r0, r2 // normalize normal dp3 r0.w, r0, r0 rsq r0.w, r0.w mul r0, r0, r0.w // l dot n dp3 ot0.x, r0, c[cv_light_direction]

15 Vertex Shader Examples

16 Vertex Shader Examples ; Distorts vertices in eye-space to give a fish-eye lens effect #include "trees.h" #define FACTOR_KPLUS1 c[cv_constants].x #define XYZW_MAX_XZRATIO x #define XYZW_FACTOR_K y #define XYZW_ZERO z #define XYZW_ONE w vs.1.0 ; Transform position to view space dp4 r0.x, v0, c[cv_worldview_0] dp4 r0.y, v0, c[cv_worldview_1] dp4 r0.z, v0, c[cv_worldview_2] dp4 r0.w, v0, c[cv_worldview_3] ; scale x and y, set z and w to 0 mul r1, r0, c[cv_fisheyeinfo].xxzz ; compute normalized distance from camera (camera in viewspace is alwasy at (0,0,0)) ; r1.x = sqrt(x^2 + y^2)/z dp3 r1.x, r1, r1 rsq r1.y, r1.x mul r1.y, r1.y, r0.z rcp r1.x, r1.y ; and take the absolute value max r1.x, r1.x, -r1.x ; compute (k*d + 1) mad r1.z, r1.x, c[cv_fisheyeinfo].xyzw_factor_k, c[cv_fisheyeinfo].xyzw_one ; compute (k+1)/(k*d + 1) -- this is the reciprocal formula of the ; above referenced web-page because our distances are ; generally not less than 1.0! rcp r1.z, r1.z mul r1.xy, FACTOR_KPLUS1, r1.z ; only scale the original x, y with this factor mul r0.xy, r0, r1 ; transform new position to clip space dp4 opos.x, r0, c[cv_proj_0] dp4 opos.y, r0, c[cv_proj_1] dp4 opos.z, r0, c[cv_proj_2] dp4 opos.w, r0, c[cv_proj_3] ; Draw using supplied tree color mov od0.xyzw, v1 mov ot0.xy, v2

17 Vertex Shader Examples

18 One Last Example

19 One Last Example vs.1.0 ; Projected Textures ; Adrian Perez ; 2/27/01 ; Constants: ; c0-c3 - World+View+Projection matrix ; c4-c7 - Texture matrix 1 ; c8 - Color ; c9-1.0 ; c 's for adjusting the texture coordinate ; c11 - Texture position 1 (worldspace) ; c12-c15 - world->model matrix ; Transform position m4x4 opos, v0, c0 ; r3: the light positoin in worldspace mov r3, c11 ; r4: the light position in modelspace m4x4 r4, r3, c12 ; r5: subtract the model-space position to get a light vector sub r5, r4, v0 ; r8: store the temp length dp3 r8.w, r5, r5 ; r6: reciprocal square root of the scalar rsq r6.xyzw, r8 ; Set r0 to the clip-space view from the texture light m4x4 r0, v0, c4 ; Normalize r5 with r6 mul r5.xyz, r5.xyz, r6.xyz ; Fill r1 with 1's mov r1, c9 ; Compute two recriprocals to do perspective correction rcp r1.xy, r0.z ; Apply reciprocals mul r2, r0, r1 ; subtract 0.5's to adjust the texture coordinates add r2.xy, r2.xy, c10.xy ; r6: Compute a dot product to find the diffuse light dp3 r6.x, r5, v3 ; modulate r6 by the diffuse color mul r6, r6.xxxx, c8 ; Write out the color and texture mov od0, r6 mov ot0, r2

20 Pixel Shaders Same idea as vertex shaders, but they control how textures and colors are combined per-pixel Currently there is no hardware that implements them The GeForce3 (when it comes out) will do them, so will the XBox

21 Pixel Shaders The Good Explicit control of texture combining Lots of Nifty Tricks (EMBM) The Bad Designed for a more general piece of hardware; a lot of the functionality of the GeForce3 is not exposed

22 Pixel Shader Registers Name I/O Min. Number Max/Inst Source cn Read-only 8 2 API call rn Read/write 2 2 Written tn Read/write 4 1 Textures vn Read-only 2 1 Vertex Colors

23 Pixel Shader Instructions add Add cnd Conditional dp3 Three-Component Vector Dot- Product lrp Linear Interpolation Blend mad Multiply and Add mov Copy Source Into Destination mul Modulate sub Loads the difference of the two colors in the source operands. tex No Modification texbem Bump Environment Map texbeml Bump Environment Map with Luminance texcoord Texture Coordinate texkill Mask Out Pixel texm3x2pad Input to 3 2 Matrix Multiply texm3x2tex 3 2 Matrix Multiply Result texreg2ar Remapping Alpha and Red Components texreg2gb Remapping Green and Blue Components texm3x3pad Input to 3 3 Matrix Multiply texm3x3spec Specular Reflection and Environment Mapping texm3x3tex 3 3 Matrix Multiply Result texm3x3vspec Specular Reflection/Environment Mapping without Constant Eye Vector

24 Pixel Shader Examples Unfortunately, right now the only way to develop pixel shader apps is to use the Reference Rasterizer. So source on how to use it is pretty scarce The documentation is also pretty cryptic, it s not nearly as wellengineered as vertex shaders are

25 Pixel Shader Examples

26 Pixel Shader Examples

27 Other Cool Shit in DX8 N-Patches Subdivision scheme that requires no adjacency information. You provide a set of vertices and vertex normals, and it renders a smooth mesh. Neat: You send the base level mesh down to the card, and your vertex shader gets fed the subdivided vertices. This is one good way to get around the fact that you can t create new vertices in a shader Bezier surfaces Yea, yea they re not as cool as N-Patches

28 N-Patches

29 Other Cool Shit in DX8 Volume Textures Holy crap these things fucking rock Finally, an elegant way to handle explosions and rocket flares Plus a million other tricks Third texture coordinate, they behave almost exactly like 2D textures

30 Other Cool Shit not in DX8 Shadow Mapping Supported by the GeForce3, but the functionality is not exposed by DX8. And yes, it is exposed in OpenGL. (sigh )

31 Conclusion DirectX 8.0 is the fucking bomb.

32 Questions????

In-Game Special Effects and Lighting

In-Game Special Effects and Lighting In-Game Special Effects and Lighting Introduction! Tomas Arce! Special Thanks! Matthias Wloka! Craig Galley! Stephen Broumley! Cryrus Lum! Sumie Arce! Inevitable! nvidia! Bungy What Is Per-Pixel Pixel

More information

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI

Tutorial on GPU Programming #2. Joong-Youn Lee Supercomputing Center, KISTI Tutorial on GPU Programming #2 Joong-Youn Lee Supercomputing Center, KISTI Contents Graphics Pipeline Vertex Programming Fragment Programming Introduction to Cg Language Graphics Pipeline The process to

More information

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems

3D buzzwords. Adding programmability to the pipeline 6/7/16. Bandwidth Gravity of modern computer systems Bandwidth Gravity of modern computer systems GPUs Under the Hood Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology The bandwidth between key components

More information

Where Is That Instruction? How To Implement Missing Vertex Shader Instructions

Where Is That Instruction? How To Implement Missing Vertex Shader Instructions Where Is That Instruction? How To Implement Missing Vertex Shader Instructions Contact: Matthias Wloka (mwloka@nvidia.com) 1. Introduction... 1 2. Constant ONE Generation... 2 3. Raise to the Power...

More information

University of Toronto: CSC467F Compilers and Interpreters, Fall 2009

University of Toronto: CSC467F Compilers and Interpreters, Fall 2009 University of Toronto: CSC467F Compilers and Interpreters, Fall 2009 ARB Fragment Program ARB fragment program is an opengl extension that allows the programmer to program the fragment processor/shader.

More information

Project6 Lighting per-pixel shading and optimizations for Direct3D 8

Project6 Lighting per-pixel shading and optimizations for Direct3D 8 Project6 Lighting per-pixel shading and optimizations for Direct3D 8 Author: Michal Valient (valient@dimension3.sk) Conversion (with some corrections) from the HTML article written in November 2002 6.0

More information

Programmable Graphics Hardware

Programmable Graphics Hardware Programmable Graphics Hardware Ian Buck Computer Systems Laboratory Stanford University Outline Why programmable graphics hardware Vertex Programs Fragment Programs CG Trends 2 Why programmable graphics

More information

Rippling Reflective and Refractive Water

Rippling Reflective and Refractive Water Rippling Reflective and Refractive Water Alex Vlachos John Isidoro Chris Oat ATI Research ATI Research ATI Research One of the classic challenges of real-time computer graphics is to generate realistic

More information

Could you make the XNA functions yourself?

Could you make the XNA functions yourself? 1 Could you make the XNA functions yourself? For the second and especially the third assignment, you need to globally understand what s going on inside the graphics hardware. You will write shaders, which

More information

1.2.3 The Graphics Hardware Pipeline

1.2.3 The Graphics Hardware Pipeline Figure 1-3. The Graphics Hardware Pipeline 1.2.3 The Graphics Hardware Pipeline A pipeline is a sequence of stages operating in parallel and in a fixed order. Each stage receives its input from the prior

More information

A Conceptual and Practical Look into Spherical Curvilinear Projection By Danny Oros

A Conceptual and Practical Look into Spherical Curvilinear Projection By Danny Oros A Conceptual and Practical Look into Spherical Curvilinear Projection By Danny Oros IMPORTANT NOTE : This document and technology is the legal property of Matrox Graphics, Inc. However, this technique

More information

Canonical Shaders for Optimal Performance. Sébastien Dominé Manager of Developer Technology Tools

Canonical Shaders for Optimal Performance. Sébastien Dominé Manager of Developer Technology Tools Canonical Shaders for Optimal Performance Sébastien Dominé Manager of Developer Technology Tools Agenda Introduction FX Composer 1.0 High Performance Shaders Basics Vertex versus Pixel Talk to your compiler

More information

Tutorial on GPU Programming. Joong-Youn Lee Supercomputing Center, KISTI

Tutorial on GPU Programming. Joong-Youn Lee Supercomputing Center, KISTI Tutorial on GPU Programming Joong-Youn Lee Supercomputing Center, KISTI GPU? Graphics Processing Unit Microprocessor that has been designed specifically for the processing of 3D graphics High Performance

More information

Chapter 3 ATI. Jason L. Mitchell

Chapter 3 ATI. Jason L. Mitchell Chapter 3 ATI Jason L. Mitchell SIGGRAPH 2002 - State of the Art in Hardware Shading Course Pixel Shading with DirectX 8.1 and the ATI RADEON 8500 Jason L. Mitchell JasonM@ati.com 3D Application Research

More information

Optimal Shaders Using High-Level Languages

Optimal Shaders Using High-Level Languages Optimal Shaders Using High-Level Languages The Good, The Bad, The Ugly All high level languages provide significant power and flexibility that: Make writing shaders easy Make writing slow shaders easy

More information

Basics of GPU-Based Programming

Basics of GPU-Based Programming Module 1: Introduction to GPU-Based Methods Basics of GPU-Based Programming Overview Rendering pipeline on current GPUs Low-level languages Vertex programming Fragment programming High-level shading languages

More information

Windowing System on a 3D Pipeline. February 2005

Windowing System on a 3D Pipeline. February 2005 Windowing System on a 3D Pipeline February 2005 Agenda 1.Overview of the 3D pipeline 2.NVIDIA software overview 3.Strengths and challenges with using the 3D pipeline GeForce 6800 220M Transistors April

More information

Vertex Shader Introduction

Vertex Shader Introduction Vertex Shader Introduction Chris Maughan (cmaughan@nvidia.com) and Matthias Wloka (mwloka@nvidia.com) NVIDIA Corporation Introduction The concept of shaders in the graphics industry is nothing new. Pixar,

More information

Computer Graphics I Lecture 11

Computer Graphics I Lecture 11 15-462 Computer Graphics I Lecture 11 Midterm Review Assignment 3 Movie Midterm Review Midterm Preview February 26, 2002 Frank Pfenning Carnegie Mellon University http://www.cs.cmu.edu/~fp/courses/graphics/

More information

Game Architecture. 2/19/16: Rasterization

Game Architecture. 2/19/16: Rasterization Game Architecture 2/19/16: Rasterization Viewing To render a scene, need to know Where am I and What am I looking at The view transform is the matrix that does this Maps a standard view space into world

More information

Introduction to Programmable GPUs CPSC 314. Real Time Graphics

Introduction to Programmable GPUs CPSC 314. Real Time Graphics Introduction to Programmable GPUs CPSC 314 Introduction to GPU Programming CS314 Gordon Wetzstein, 02/2011 Real Time Graphics Introduction to GPU Programming CS314 Gordon Wetzstein, 02/2011 1 GPUs vs CPUs

More information

CS 354R: Computer Game Technology

CS 354R: Computer Game Technology CS 354R: Computer Game Technology Texture and Environment Maps Fall 2018 Texture Mapping Problem: colors, normals, etc. are only specified at vertices How do we add detail between vertices without incurring

More information

Spring 2011 Prof. Hyesoon Kim

Spring 2011 Prof. Hyesoon Kim Spring 2011 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

More information

Mattan Erez. The University of Texas at Austin

Mattan Erez. The University of Texas at Austin EE382V: Principles in Computer Architecture Parallelism and Locality Fall 2008 Lecture 10 The Graphics Processing Unit Mattan Erez The University of Texas at Austin Outline What is a GPU? Why should we

More information

Technical Report. Mesh Instancing

Technical Report. Mesh Instancing Technical Report Mesh Instancing Abstract What is Mesh Instancing? Before we talk about instancing, let s briefly talk about the way that most D3D applications work. In order to draw a polygonal object

More information

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1 Markus Hadwiger, KAUST Reading Assignment #4 (until Feb. 23) Read (required): Programming Massively Parallel Processors book, Chapter

More information

Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1

Graphics Hardware. Computer Graphics COMP 770 (236) Spring Instructor: Brandon Lloyd 2/26/07 1 Graphics Hardware Computer Graphics COMP 770 (236) Spring 2007 Instructor: Brandon Lloyd 2/26/07 1 From last time Texture coordinates Uses of texture maps reflectance and other surface parameters lighting

More information

Spring 2009 Prof. Hyesoon Kim

Spring 2009 Prof. Hyesoon Kim Spring 2009 Prof. Hyesoon Kim Application Geometry Rasterizer CPU Each stage cane be also pipelined The slowest of the pipeline stage determines the rendering speed. Frames per second (fps) Executes on

More information

Introduction to Programmable GPUs CPSC 314. Introduction to GPU Programming CS314 Gordon Wetzstein, 09/03/09

Introduction to Programmable GPUs CPSC 314. Introduction to GPU Programming CS314 Gordon Wetzstein, 09/03/09 Introduction to Programmable GPUs CPSC 314 News Homework: no new homework this week (focus on quiz prep) Quiz 2 this Friday topics: everything after transformations up until last Friday's lecture questions

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

Introduction to Shaders.

Introduction to Shaders. Introduction to Shaders Marco Benvegnù hiforce@gmx.it www.benve.org Summer 2005 Overview Rendering pipeline Shaders concepts Shading Languages Shading Tools Effects showcase Setup of a Shader in OpenGL

More information

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics Why GPU? Chapter 1 Graphics Hardware Graphics Processing Unit (GPU) is a Subsidiary hardware With massively multi-threaded many-core Dedicated to 2D and 3D graphics Special purpose low functionality, high

More information

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008.

CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions. The Midterm Exam was given in class on Thursday, October 23, 2008. CS 381 Computer Graphics, Fall 2008 Midterm Exam Solutions The Midterm Exam was given in class on Thursday, October 23, 2008. 1. [4 pts] Drawing Where? Your instructor says that objects should always be

More information

ECE 574 Cluster Computing Lecture 16

ECE 574 Cluster Computing Lecture 16 ECE 574 Cluster Computing Lecture 16 Vince Weaver http://web.eece.maine.edu/~vweaver vincent.weaver@maine.edu 26 March 2019 Announcements HW#7 posted HW#6 and HW#5 returned Don t forget project topics

More information

Hardware-Assisted Relief Texture Mapping

Hardware-Assisted Relief Texture Mapping EUROGRAPHICS 0x / N.N. and N.N. Short Presentations Hardware-Assisted Relief Texture Mapping Masahiro Fujita and Takashi Kanai Keio University Shonan-Fujisawa Campus, Fujisawa, Kanagawa, Japan Abstract

More information

CS 4620 Program 3: Pipeline

CS 4620 Program 3: Pipeline CS 4620 Program 3: Pipeline out: Wednesday 14 October 2009 due: Friday 30 October 2009 1 Introduction In this assignment, you will implement several types of shading in a simple software graphics pipeline.

More information

Direct Rendering of Trimmed NURBS Surfaces

Direct Rendering of Trimmed NURBS Surfaces Direct Rendering of Trimmed NURBS Surfaces Hardware Graphics Pipeline 2/ 81 Hardware Graphics Pipeline GPU Video Memory CPU Vertex Processor Raster Unit Fragment Processor Render Target Screen Extended

More information

Shaders (some slides taken from David M. course)

Shaders (some slides taken from David M. course) Shaders (some slides taken from David M. course) Doron Nussbaum Doron Nussbaum COMP 3501 - Shaders 1 Traditional Rendering Pipeline Traditional pipeline (older graphics cards) restricts developer to texture

More information

CHAPTER 1 Graphics Systems and Models 3

CHAPTER 1 Graphics Systems and Models 3 ?????? 1 CHAPTER 1 Graphics Systems and Models 3 1.1 Applications of Computer Graphics 4 1.1.1 Display of Information............. 4 1.1.2 Design.................... 5 1.1.3 Simulation and Animation...........

More information

Optimisation. CS7GV3 Real-time Rendering

Optimisation. CS7GV3 Real-time Rendering Optimisation CS7GV3 Real-time Rendering Introduction Talk about lower-level optimization Higher-level optimization is better algorithms Example: not using a spatial data structure vs. using one After that

More information

Sung-Eui Yoon ( 윤성의 )

Sung-Eui Yoon ( 윤성의 ) Introduction to Computer Graphics and OpenGL Graphics Hardware Sung-Eui Yoon ( 윤성의 ) Course URL: http://sglab.kaist.ac.kr/~sungeui/etri_cg/ Class Objectives Understand how GPUs have been evolved Understand

More information

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer

Real-Time Rendering (Echtzeitgraphik) Michael Wimmer Real-Time Rendering (Echtzeitgraphik) Michael Wimmer wimmer@cg.tuwien.ac.at Walking down the graphics pipeline Application Geometry Rasterizer What for? Understanding the rendering pipeline is the key

More information

Vertex Shader Design I

Vertex Shader Design I The following content is extracted from the paper shown in next page. If any wrong citation or reference missing, please contact ldvan@cs.nctu.edu.tw. I will correct the error asap. This course used only

More information

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Level: Intermediate Area: Graphics Programming Summary This document is an introduction to the series of samples,

More information

lecture 18 - ray tracing - environment mapping - refraction

lecture 18 - ray tracing - environment mapping - refraction lecture 18 - ray tracing - environment mapping - refraction Recall Ray Casting (lectures 7, 8) for each pixel (x,y) { cast a ray through that pixel into the scene, and find the closest surface along the

More information

Cg 2.0. Mark Kilgard

Cg 2.0. Mark Kilgard Cg 2.0 Mark Kilgard What is Cg? Cg is a GPU shading language C/C++ like language Write vertex-, geometry-, and fragmentprocessing kernels that execute on massively parallel GPUs Productivity through a

More information

Shading Languages for Graphics Hardware

Shading Languages for Graphics Hardware Shading Languages for Graphics Hardware Bill Mark and Kekoa Proudfoot Stanford University Collaborators: Pat Hanrahan, Svetoslav Tzvetkov, Pradeep Sen, Ren Ng Sponsors: ATI, NVIDIA, SGI, SONY, Sun, 3dfx,

More information

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1

X. GPU Programming. Jacobs University Visualization and Computer Graphics Lab : Advanced Graphics - Chapter X 1 X. GPU Programming 320491: Advanced Graphics - Chapter X 1 X.1 GPU Architecture 320491: Advanced Graphics - Chapter X 2 GPU Graphics Processing Unit Parallelized SIMD Architecture 112 processing cores

More information

Drawing Fast The Graphics Pipeline

Drawing Fast The Graphics Pipeline Drawing Fast The Graphics Pipeline CS559 Fall 2015 Lecture 9 October 1, 2015 What I was going to say last time How are the ideas we ve learned about implemented in hardware so they are fast. Important:

More information

Hardware Shading on the ATI RADEON Jason L. Mitchell ATI Research

Hardware Shading on the ATI RADEON Jason L. Mitchell ATI Research Hardware Shading on the ATI RADEON 9700 Jason L. Mitchell ATI Research JasonM@ati.com Outline RADEON 9700 Shader Models 2.0 vertex and pixel shaders in DirectX 9 ATI_fragment_program OpenGL Extension Compulsories

More information

Evolution of GPUs Chris Seitz

Evolution of GPUs Chris Seitz Evolution of GPUs Chris Seitz Overview Concepts: Real-time rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 1995-1998: Texture mapping and z-buffer 1998: Multitexturing

More information

Rendering Subdivision Surfaces Efficiently on the GPU

Rendering Subdivision Surfaces Efficiently on the GPU Rendering Subdivision Surfaces Efficiently on the GPU Gy. Antal, L. Szirmay-Kalos and L. A. Jeni Department of Algorithms and their Applications, Faculty of Informatics, Eötvös Loránd Science University,

More information

Advanced Texture-Mapping Curves and Curved Surfaces. Pre-Lecture Business. Texture Modes. Texture Modes. Review quiz

Advanced Texture-Mapping Curves and Curved Surfaces. Pre-Lecture Business. Texture Modes. Texture Modes. Review quiz Advanced Texture-Mapping Curves and Curved Surfaces Pre-ecture Business loadtexture example midterm handed bac, code posted (still) get going on pp3! more on texturing review quiz CS148: Intro to CG Instructor:

More information

DirectX 9 Shading Jason L. Mitchell 3D Application Research Group Lead

DirectX 9 Shading Jason L. Mitchell 3D Application Research Group Lead DirectX 9 Shading Jason L. Mitchell 3D Application Research Group Lead JasonM@ati.com ATI Mojo Day Shading Outline DirectX 8.1 1.4 Pixel Shader Review Depth sprites DirectX 9 2.0 Pixel Shaders Procedural

More information

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology

Graphics Performance Optimisation. John Spitzer Director of European Developer Technology Graphics Performance Optimisation John Spitzer Director of European Developer Technology Overview Understand the stages of the graphics pipeline Cherchez la bottleneck Once found, either eliminate or balance

More information

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev

C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE. Mikhail Bessmeltsev C P S C 314 S H A D E R S, O P E N G L, & J S RENDERING PIPELINE UGRAD.CS.UBC.C A/~CS314 Mikhail Bessmeltsev 1 WHAT IS RENDERING? Generating image from a 3D scene 2 WHAT IS RENDERING? Generating image

More information

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 3: GPU Architecture 2 Markus Hadwiger, KAUST Reading Assignment #2 (until Feb. 9) Read (required): GLSL book, chapter 4 (The OpenGL Programmable Pipeline) GPU

More information

Lecture 2. Shaders, GLSL and GPGPU

Lecture 2. Shaders, GLSL and GPGPU Lecture 2 Shaders, GLSL and GPGPU Is it interesting to do GPU computing with graphics APIs today? Lecture overview Why care about shaders for computing? Shaders for graphics GLSL Computing with shaders

More information

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Shadow Buffer Theory Observation:

More information

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal

Graphics Hardware, Graphics APIs, and Computation on GPUs. Mark Segal Graphics Hardware, Graphics APIs, and Computation on GPUs Mark Segal Overview Graphics Pipeline Graphics Hardware Graphics APIs ATI s low-level interface for computation on GPUs 2 Graphics Hardware High

More information

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský

Real - Time Rendering. Graphics pipeline. Michal Červeňanský Juraj Starinský Real - Time Rendering Graphics pipeline Michal Červeňanský Juraj Starinský Overview History of Graphics HW Rendering pipeline Shaders Debugging 2 History of Graphics HW First generation Second generation

More information

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1

Module Contact: Dr Stephen Laycock, CMP Copyright of the University of East Anglia Version 1 UNIVERSITY OF EAST ANGLIA School of Computing Sciences Main Series PG Examination 2013-14 COMPUTER GAMES DEVELOPMENT CMPSME27 Time allowed: 2 hours Answer any THREE questions. (40 marks each) Notes are

More information

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies

How to Work on Next Gen Effects Now: Bridging DX10 and DX9. Guennadi Riguer ATI Technologies How to Work on Next Gen Effects Now: Bridging DX10 and DX9 Guennadi Riguer ATI Technologies Overview New pipeline and new cool things Simulating some DX10 features in DX9 Experimental techniques Why This

More information

A Real-Time Procedural Shading System for Programmable Graphics Hardware

A Real-Time Procedural Shading System for Programmable Graphics Hardware A Real-Time Procedural Shading System for Programmable Graphics Hardware Kekoa Proudfoot William R. Mark Pat Hanrahan Stanford University Svetoslav Tzvetkov NVIDIA Corporation http://graphics.stanford.edu/projects/shading/

More information

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline:

Graphics Processing Units (GPUs) V1.2 (January 2010) Outline. High-Level Pipeline. 1. GPU Pipeline: Graphics Processing Units (GPUs) V1.2 (January 2010) Anthony Steed Based on slides from Jan Kautz (v1.0) Outline 1. GPU Pipeline: s Lighting Rasterization Fragment Operations 2. Vertex Shaders 3. Pixel

More information

Programming Graphics Hardware

Programming Graphics Hardware Tutorial 5 Programming Graphics Hardware Randy Fernando, Mark Harris, Matthias Wloka, Cyril Zeller Overview of the Tutorial: Morning 8:30 9:30 10:15 10:45 Introduction to the Hardware Graphics Pipeline

More information

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 3: GPU Architecture 2. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 3: GPU Architecture 2 Markus Hadwiger, KAUST Reading Assignment #2 (until Feb. 17) Read (required): GLSL book, chapter 4 (The OpenGL Programmable Pipeline) GPU

More information

AGDC Per-Pixel Shading. Sim Dietrich

AGDC Per-Pixel Shading. Sim Dietrich AGDC Per-Pixel Shading Sim Dietrich Goal Of This Talk The new features of Dx8 and the next generation of HW make huge strides in the area of Per-Pixel Shading Most developers have yet to adopt Per-Pixel

More information

Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03

Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03 1 Real Time Rendering of Complex Height Maps Walking an infinite realistic landscape By: Jeffrey Riaboy Written 9/7/03 Table of Contents 1 I. Overview 2 II. Creation of the landscape using fractals 3 A.

More information

EMBEDDED VERTEX SHADER IN FPGA

EMBEDDED VERTEX SHADER IN FPGA EMBEDDED VERTEX SHADER IN FPGA Lars Middendorf, Felix Mühlbauer 1, Georg Umlauf 2, Christophe Bobda 1 1 Self-Organizing Embedded Systems Group, Department of Computer Science University of Kaiserslautern

More information

Ultimate Graphics Performance for DirectX 10 Hardware

Ultimate Graphics Performance for DirectX 10 Hardware Ultimate Graphics Performance for DirectX 10 Hardware Nicolas Thibieroz European Developer Relations AMD Graphics Products Group nicolas.thibieroz@amd.com V1.01 Generic API Usage DX10 designed for performance

More information

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information

Ray Casting of Trimmed NURBS Surfaces on the GPU

Ray Casting of Trimmed NURBS Surfaces on the GPU Ray Casting of Trimmed NURBS Surfaces on the GPU Hans-Friedrich Pabst Jan P. Springer André Schollmeyer Robert Lenhardt Christian Lessig Bernd Fröhlich Bauhaus University Weimar Faculty of Media Virtual

More information

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11

Pipeline Operations. CS 4620 Lecture Steve Marschner. Cornell CS4620 Spring 2018 Lecture 11 Pipeline Operations CS 4620 Lecture 11 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives to pixels RASTERIZATION

More information

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping

Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping Computer Graphics (CS 543) Lecture 10: Normal Maps, Parametrization, Tone Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Normal Mapping Store normals in texture

More information

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský

Real - Time Rendering. Pipeline optimization. Michal Červeňanský Juraj Starinský Real - Time Rendering Pipeline optimization Michal Červeňanský Juraj Starinský Motivation Resolution 1600x1200, at 60 fps Hw power not enough Acceleration is still necessary 3.3.2010 2 Overview Application

More information

Self-shadowing Bumpmap using 3D Texture Hardware

Self-shadowing Bumpmap using 3D Texture Hardware Self-shadowing Bumpmap using 3D Texture Hardware Tom Forsyth, Mucky Foot Productions Ltd. TomF@muckyfoot.com Abstract Self-shadowing bumpmaps add realism and depth to scenes and provide important visual

More information

Graphics Hardware. Instructor Stephen J. Guy

Graphics Hardware. Instructor Stephen J. Guy Instructor Stephen J. Guy Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability! Programming Examples Overview What is a GPU Evolution of GPU GPU Design Modern Features Programmability!

More information

CS 130 Final. Fall 2015

CS 130 Final. Fall 2015 CS 130 Final Fall 2015 Name Student ID Signature You may not ask any questions during the test. If you believe that there is something wrong with a question, write down what you think the question is trying

More information

A Low Power Multimedia SoC with Fully Programmable 3D Graphics and MPEG4/H.264/JPEG for Mobile Devices

A Low Power Multimedia SoC with Fully Programmable 3D Graphics and MPEG4/H.264/JPEG for Mobile Devices A Low Power Multimedia SoC with Fully Programmable 3D Graphics and MPEG4/H.264/JPEG for Mobile Devices Jeong-Ho Woo, Ju-Ho Sohn, Hyejung Kim, Jongcheol Jeong 1, Euljoo Jeong 1, Suk Joong Lee 1 and Hoi-Jun

More information

CAL Kernel Programming

CAL Kernel Programming 1 CAL Kernel Programming Module Overview CAL Kernel Programming APIs Overview of AMD IL Overview of AMD GPU ISA 2 CAL Kernel Programming APIs AMD Brook+ DirectX High Level Shading Language (HLSL) AMD Intermediate

More information

Programmable Graphics Hardware

Programmable Graphics Hardware CSCI 480 Computer Graphics Lecture 14 Programmable Graphics Hardware [Ch. 9] March 2, 2011 Jernej Barbic University of Southern California OpenGL Extensions Shading Languages Vertex Program Fragment Program

More information

Introduction to the Direct3D 11 Graphics Pipeline

Introduction to the Direct3D 11 Graphics Pipeline Introduction to the Direct3D 11 Graphics Pipeline Kevin Gee - XNA Developer Connection Microsoft Corporation 2008 NVIDIA Corporation. Direct3D 11 focuses on Key Takeaways Increasing scalability, Improving

More information

Introduction to the DirectX 9 Shader Models

Introduction to the DirectX 9 Shader Models Introduction to the DirectX 9 Shader Models Sim Dietrich SDietrich@nvidia.com Jason L. Mitchell JasonM@ati.com Outline Vertex Shaders vs_2_0 and extended bits vs_3_0 Pixel Shaders ps_2_0 and extended bits

More information

Teaching Cg. This presentation introduces Cg ( C for graphics ) and explains why it would be useful when teaching a computer graphics course.

Teaching Cg. This presentation introduces Cg ( C for graphics ) and explains why it would be useful when teaching a computer graphics course. Teaching Cg This presentation introduces Cg ( C for graphics ) and explains why it would be useful when teaching a computer graphics course. 1 Real-Time Graphics Has Come a Long Way Virtua Fighter (SEGA

More information

12.2 Programmable Graphics Hardware

12.2 Programmable Graphics Hardware Fall 2018 CSCI 420: Computer Graphics 12.2 Programmable Graphics Hardware Kyle Morgenroth http://cs420.hao-li.com 1 Introduction Recent major advance in real time graphics is the programmable pipeline:

More information

GpuPy: Accelerating NumPy With a GPU

GpuPy: Accelerating NumPy With a GPU GpuPy: Accelerating NumPy With a GPU Washington State University School of Electrical Engineering and Computer Science Benjamin Eitzen - eitzenb@eecs.wsu.edu Robert R. Lewis - bobl@tricity.wsu.edu Presentation

More information

Real-Time Graphics Architecture

Real-Time Graphics Architecture Real-Time Graphics Architecture Kurt Akeley Pat Hanrahan http://www.graphics.stanford.edu/courses/cs448a-01-fall Geometry Outline Vertex and primitive operations System examples emphasis on clipping Primitive

More information

Programming shaders & GPUs Christian Miller CS Fall 2011

Programming shaders & GPUs Christian Miller CS Fall 2011 Programming shaders & GPUs Christian Miller CS 354 - Fall 2011 Fixed-function vs. programmable Up until 2001, graphics cards implemented the whole pipeline for you Fixed functionality but configurable

More information

Graphics Processing Unit Architecture (GPU Arch)

Graphics Processing Unit Architecture (GPU Arch) Graphics Processing Unit Architecture (GPU Arch) With a focus on NVIDIA GeForce 6800 GPU 1 What is a GPU From Wikipedia : A specialized processor efficient at manipulating and displaying computer graphics

More information

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012.

CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions. The Midterm Exam was given in class on Tuesday, October 16, 2012. CS 381 Computer Graphics, Fall 2012 Midterm Exam Solutions The Midterm Exam was given in class on Tuesday, October 16, 2012. 1. [7 pts] Synthetic-Camera Model. Describe the Synthetic-Camera Model : how

More information

Pipeline Operations. CS 4620 Lecture 14

Pipeline Operations. CS 4620 Lecture 14 Pipeline Operations CS 4620 Lecture 14 2014 Steve Marschner 1 Pipeline you are here APPLICATION COMMAND STREAM 3D transformations; shading VERTEX PROCESSING TRANSFORMED GEOMETRY conversion of primitives

More information

GeForce4. John Montrym Henry Moreton

GeForce4. John Montrym Henry Moreton GeForce4 John Montrym Henry Moreton 1 Architectural Drivers Programmability Parallelism Memory bandwidth 2 Recent History: GeForce 1&2 First integrated geometry engine & 4 pixels/clk Fixed-function transform,

More information

Interactive Cloth Simulation. Matthias Wloka NVIDIA Corporation

Interactive Cloth Simulation. Matthias Wloka NVIDIA Corporation Interactive Cloth Simulation Matthias Wloka NVIDIA Corporation MWloka@nvidia.com Overview Higher-order surfaces Vertex-shader deformations Lighting modes Per-vertex diffuse Per-pixel diffuse with bump-map

More information

CS427 Multicore Architecture and Parallel Computing

CS427 Multicore Architecture and Parallel Computing CS427 Multicore Architecture and Parallel Computing Lecture 6 GPU Architecture Li Jiang 2014/10/9 1 GPU Scaling A quiet revolution and potential build-up Calculation: 936 GFLOPS vs. 102 GFLOPS Memory Bandwidth:

More information

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1

Programmable GPUs. Real Time Graphics 11/13/2013. Nalu 2004 (NVIDIA Corporation) GeForce 6. Virtua Fighter 1995 (SEGA Corporation) NV1 Programmable GPUs Real Time Graphics Virtua Fighter 1995 (SEGA Corporation) NV1 Dead or Alive 3 2001 (Tecmo Corporation) Xbox (NV2A) Nalu 2004 (NVIDIA Corporation) GeForce 6 Human Head 2006 (NVIDIA Corporation)

More information

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations.

The Importance of Matrices in the DirectX API. by adding support in the programming language for frequently used calculations. Hermann Chong Dr. King Linear Algebra Applications 28 November 2001 The Importance of Matrices in the DirectX API In the world of 3D gaming, there are two APIs (Application Program Interface) that reign

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences

More information

Threading Hardware in G80

Threading Hardware in G80 ing Hardware in G80 1 Sources Slides by ECE 498 AL : Programming Massively Parallel Processors : Wen-Mei Hwu John Nickolls, NVIDIA 2 3D 3D API: API: OpenGL OpenGL or or Direct3D Direct3D GPU Command &

More information

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design:

Software Engineering. ò Look up Design Patterns. ò Code Refactoring. ò Code Documentation? ò One of the lessons to learn for good design: Software Engineering ò Look up Design Patterns ò Code Refactoring ò Code Documentation? ò One of the lessons to learn for good design: ò Coupling: the amount of interconnectedness between classes ò Cohesion:

More information