Dr' Scott Schaefer - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

Dr' Scott Schaefer

Description:

Nvidia Geforce 6800 GTX1. 6.4 billion pixels/sec. Nvidia Geforce 7900 GTX2. 15.6 ... Limited success because problems must be crammed into graphics pipeline ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 31
Provided by: symo5
Category:

less

Transcript and Presenter's Notes

Title: Dr' Scott Schaefer


1
Programmable Shaders
  • Dr. Scott Schaefer

2
Graphics Cards Performance
  • Nvidia Geforce 6800 GTX1
  • 6.4 billion pixels/sec
  • Nvidia Geforce 7900 GTX2
  • 15.6 billion pixels/sec
  • Xbox 3603
  • 16 billion pixels/sec (4X AA)
  • Nvidia Geforce 8800 GTX4
  • 36.8 billion pixels/sec

1 http//www.nvidia.com/page/geforce_6800.html 2
http//www.nvidia.com/page/geforce_7900.html 3
http//news.com.com/Xboxspecsrevealed/2100-1043_
3-5705372.html 4 http//www.nvidia.com/page/gefo
rce_8800.html
3
Parallel Processing Power
  • Nvidia Geforce 8800 GTX
  • 128 programmable processors
  • 1.35 GHz each
  • 86.4 GB/s memory bandwidth
  • 768MB memory

http//www.nvidia.com/page/geforce_8800.html
4
Graphics Pipeline
Vertices
5
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
6
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Transformed Vertices
7
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Transformed Vertices
Viewport Transformation
8
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
9
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
10
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
11
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
Interpolation/Rasterization
12
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
Interpolation/Rasterization
Pixel Location/Color/Depth
13
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
Interpolation/Rasterization
Pixel Location/Color/Depth
Visibility Determination
14
Graphics Pipeline
Vertices
Vertex Transformation/Lighting
Vertex Index Stream
Transformed Vertices
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
Interpolation/Rasterization
Pixel Location/Color/Depth
Visibility Determination
Frame Buffer
15
Programmable Graphics Pipeline
Vertices
Vertex Shader
Vertex Index Stream
Transformed Vertices/ Normals/Texture coords/
Viewport Transformation
Triangle Setup
Backface Culling
Clipping
Interpolated Vertex Data
Interpolation/Rasterization
Pixel Shader
Pixel Location
Visibility Determination
Color/Depth
Frame Buffer
16
Graphics Cards
  • Nvidia Geforce 6800 GTX1
  • 6 vertex shaders
  • 16 pixel shaders
  • Nvidia Geforce 7900 GTX2
  • 8 vertex shaders
  • 24 pixel shaders
  • Xbox 3603
  • 48 general purpose shaders
  • Nvidia Geforce 8800 GTX4
  • 128 stream processors

1 http//www.nvidia.com/page/geforce_6800.html 2
http//www.nvidia.com/page/geforce_7900.html 3
http//news.com.com/Xboxspecsrevealed/2100-1043_
3-5705372.html 4 http//www.nvidia.com/page/gefo
rce_8800.html
17
Shader Programming
  • Many different languages
  • Assembly
  • OpenGL Shading Language
  • Nvidias CG
  • Microsofts HLSL
  • Different capabilities based on shader model
  • Register count
  • Instructions
  • Maximum number of instructions

18
Vertex Shaders
  • Input anything associated with vertices
  • Position, normal, texture coordinates, etc
  • Output transformed vertices
  • MUST output position
  • Can produce color, normal, texture coordinates,
    etc

19
Vertex Shaders
  • // vertex shader output structure
  • struct VS_OUTPUT
  • float4 Pos POSITION

20
Vertex Shaders
  • VS_OUTPUT VS(
  • float3 InPos POSITION // Vertex position
    in model space
  • )
  • VS_OUTPUT Out (VS_OUTPUT)0
  • // transform the position
  • float3 transformedPos mul(float4(InPos, 1),
    (float4x3)World)
  • Out.Pos mul(float4(transformedPos,1),
    ViewProjection)
  • return Out

21
Pixel Shaders
  • Input Vertex data produced from vertex shader
  • Output
  • MUST output color
  • Can output depth as well
  • Cannot change location of pixel on screen

22
Pixel Shaders
  • float4 PS ( VS_OUTPUT In ) COLOR
  • // may perform texture lookup, depth effects,
    fog, etc
  • return float4 ( 1, 1, 1, 1 )

23
Gouraud Shading Example
  • // vertex shader output structure
  • struct VS_OUTPUT
  • float4 Pos POSITION
  • float4 Color COLOR

24
Gouraud Shading Example
  • VS_OUTPUT VS(
  • float3 InPos POSITION, // Vertex
    position in model space
  • float3 InNormal NORMAL // Vertex normal in
    model space
  • )
  • VS_OUTPUT Out (VS_OUTPUT)0
  • // transform the position and normal
  • float3 transformedPos mul(float4(InPos, 1),
    (float4x3)World)
  • Out.Pos mul(float4(transformedPos,1),
    ViewProjection)
  • float3 transNormal mul(InNormal,
    (float3x3)World) // normal (view space)
  • Out.Color float4 ( calcColor ( normalize (
    lightPos transformedPos ), transNormal,

  • normalize ( eyePos transformedPos ) ), 1 )
  • return Out

25
Gouraud Shading Example
  • float3 calcColor ( float3 lightVec, float3
    normal, float3 eyeToVertex )
  • float3 color 0
  • color lightColor MaterialAmbient
  • color lightColor MaterialDiffuse max
    ( 0, dot ( normal, lightVec ) )
  • float3 R normalize ( reflect ( lightVec,
    normal ) )
  • color lightColor MaterialSpecular pow
    ( max ( 0, dot ( R,
  • eyeToVertex ) ),
    MaterialSpecularPower )
  • return color

26
Gouraud Shading Example
  • float4 PS ( VS_OUTPUT In ) COLOR
  • return In.Color

27
Phong Shading Example
  • // vertex shader output structure
  • struct VS_OUTPUT
  • float4 Pos POSITION
  • float3 Normal TEXCOORD0
  • float3 TransformedPos TEXCOORD1

28
Phong Shading Example
  • VS_OUTPUT VS(
  • float3 InPos POSITION, // Vertex
    position in model space
  • float3 InNormal NORMAL // Vertex normal in
    model space
  • )
  • VS_OUTPUT Out (VS_OUTPUT)0
  • // transform the position and normal
  • Out.TransformedPos mul(float4(InPos, 1),
    (float4x3)World)
  • Out.Pos mul(float4(Out.TransformedPos,1),
    ViewProjection)
  • Out.Normal mul(InNormal, (float3x3)World)
    // normal (view space)
  • return Out

29
Phong Shading Example
  • float4 PS ( VS_OUTPUT In ) COLOR
  • // vector from vertex towards eye
  • float3 EyeToVertex normalize (
    In.TransformedPos - EyePos )
  • float3 normal normalize ( In.Normal )
  • float4 color calcColor ( normalize (
    lightPos In.TransformedPos ), normal,

  • EyeToVertex )
  • return color

30
General Purpose GPU Programming
  • Limited success because problems must be crammed
    into graphics pipeline
  • General purpose computation starting to become
    available
  • Nvidias CUDA
  • Peakstream
Write a Comment
User Comments (0)
About PowerShow.com