Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 Chris Kerkhoff Matthew Sullivan 10/16/2009

2  Shaders are simple programs that describe the traits of either a vertex or a pixel.  Shaders replace a section of video hardware that's typically called the Fixed Function Pipeline (FFP).  The FFP performs lighting and texture mapping in a hard-coded manner, while shaders let you replace this hard-coded approach with a programmable one.

3  Pixel  Calculates actual color for a pixel  Vertex  Projects 3D points onto 2D plane (the viewport) and calculates Z depth  Geometry  Modifies existing 3D meshes or creates new ones from formulas

4  The CPU sends instructions and geometry data to the GPU.  Within the vertex shader, the geometry is transformed and lighting calculations are performed.  If a geometry shader is in the graphic processing unit, some changes of the geometries in the scene are performed.  The calculated geometry is triangulated (subdivided into triangles).  Triangles are transformed into pixel quads (one pixel quad is a 2 × 2 pixel primitive).

5  Real world optics and lighting are far too complex for even the fastest computers  Ray tracing which is state of the art for 3D graphics is still too complex to run in realtime for scenes of a high enough complexity to look real  Shaders are written to apply transformations to a large set of elements at a time  Modern GPUs have multiple shader pipelines

6  The only type of Shader that actually shades anything  Takes a color from a texture map and modifies by the effect of various light sources on the surface  A simplified model is: Ambient+Lambertian+Specular  Ambient is fake light to avoid the need for environmental lighting to fill in shadow  Lambertian represents the coloring of a perfectly diffuse (or flat) surface  Specular highlighting is the result of a perfectly glossy surface; the real world is combination of the two.

7

8  Large Frame Buffer  Complicated Pipeline  It’s fixed-function  But we can specify shader programs that execute in certain pipeline stages

9

10  No random-access memory writes  Can write to current pixel in frame buffer  Can’t create data structures  Can’t traverse data structures  Can hack it using texture accesses  Hard to share data between main program and shader programs  Weird programming language  HLSL (High Level Shader Language, similar to Cg)

11  Manipulate vertices and textures  Implement oversampling and interpolation techniques  Most of these computations involve matrix and vector operations  Good for Scientists and Engineers

12  GLSL (OpenGL Shading Language)in OpenGL (1.5+)  HLSL (High Level Shader Language) in Microsoft Direct3D API (Direct3D 9+)  Cg (C for Graphics) developed by Nvidia for programming vertex and pixel shaders

13  Early video cards had dedicated processors for different shaders (Vertex, Geometry, Pixel)  This simplified the hardware requirements for each type but was inflexible  Modern video cards (DirectX 10 and newer; GeForce 8xxx+, Radeon HD) have universal shaders which can be assigned to the different functions at the discretion of the programmer.

14  There are a few early programs that attempted to use dedicated shaders for GPGPU, but the limitations make this very challenging and inefficient  Universal shaders with their increased flexibility allowed for GPGPU to really take off

15

16  http://graphics.cs.williams.edu/archive/Sweeney HPG2009/TimHPG2009.pdf http://graphics.cs.williams.edu/archive/Sweeney HPG2009/TimHPG2009.pdf  http://wapedia.mobi/en/Shader_Model http://wapedia.mobi/en/Shader_Model  http://www.absoluteastronomy.com/topics/Pixel _shader http://www.absoluteastronomy.com/topics/Pixel _shader  http://en.wikipedia.org/wiki/Shaders http://en.wikipedia.org/wiki/Shaders  http://en.wikipedia.org/wiki/Shader_%28realtim e,_logical%29 http://en.wikipedia.org/wiki/Shader_%28realtim e,_logical%29  http://my.opera.com/Vorlath/blog/2008/01/22/ opengl-pixel-shaders-and-why-the-future-of- software-depends-on-it http://my.opera.com/Vorlath/blog/2008/01/22/ opengl-pixel-shaders-and-why-the-future-of- software-depends-on-it


Download ppt "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."

Similar presentations


Ads by Google