A Framework for Analyzing Real-Time Advanced Shading Techniques

Shared by: juanagui
-
Stats
views:
17
posted:
4/28/2009
language:
English
pages:
22
Document Sample
scope of work template
							        A Framework for
        Analyzing Real-Time
        Advanced Shading
        Techniques

   John C. Hart           Peter K. Doenges
University of Illinois   Evans & Sutherland
        Permuting the
        Graphics Pipeline
• Recent advances in real-time shading
  order operations differently than the
  classical graphics pipeline
  Fragment lighting, texture shading, multipass
    rendering, multitexturing, environment-
    mapped bump mapping, normal mapping,
    …
• Use a grammar to express, catalog and
  analyze real-time shadings techniques
         Pipeline Grammar
• Data types denote formats of data through
  the graphics pipeline
• Operators denote transformations of the data
  types into other data types
• Operator notation:
                     y=Fx
                    z=FGy
• Permutation:
                What if z = G F y?
         Shader Data Types
x    Vertex in model coordinates (x,y,z)
u    Surface parameterization (u,v)
s    Shading params (s,t,r) or (N,V,L,R,H)

ux   Texcoords stores at vertex x
sx   Shader params stored at vertex x

xs   Vertex in viewport coordinates (xs,ys)
c    Color vector (R,G,B)
        Shader Operators
                           y
p   Model-to-viewport:             p        ys
    x  xs             z       x
                                       xs

d   Rasterization:
    xs  xs                    d
    (lerp + sampling)

p   Shader: s  c              p
         Image Operators
C   Framebuffer: xs  c
    - Look up a previously stored color in the
    frame buffer

T   Texture map: u  c
    - Look up a texture map location

 Assignment: C(xs,ys)  c, T(u,v)  c
  - Stores a color in a lookup table
         Standard Pipeline
• Gouraud                 • Texture map
Cdpxdpsx                 CdpxTdux
           addr   d   pixel   p   x

   C       data   d   pixel   p   s   model

           data   T    addr   d   u

• Modulation
C d p x  (d p s x)  (T d u x)
        Fragment Lighting
• Fragment is a rendered sample (e.g.
  pixel)
• Applies shader to each pixel as it is
  rasterized
• Renderman, hardware Phong, bump
  mapping
• What now happens per-pass in modern
  graphics cards
      Fragment Lighting
Cdpxpdsx
       addr   d   pixel   p   x
  C                               model
       data   p   pixel   d   s

• Commutes Gouraud
Cdpxdpsx
          Texture Shading



v = N.H




           u = N.L
        Texture Shading
Precompute shader, store in texture map
Use tex coord to index shader parameters
Tdupsdu
         addr       d       pixel   u       x
  T                                                 model
        data    p       s     s     u   d       u

CdpxTdusx
                          Modern GPU Org.
 Geometry
(vertex stream)       Vertex Shader                Setup      Rasterization
                  1   2   3   4
                      1   2   3    4
                          1   2    3   4
                              1    2   3   4



                                  Texture Memory              Pixel Shader
                          Tex 0
                          Tex 1
                          Tex 2


                                               Frame Buffer
          Modern GPU Pipeline
C d v x  f ((d v s x)  (T, T’, T’’, …))

v     vertex shader
      - input: x (and assoc. attributes)
      - output: screen coords vertex color/attrs
f     fragment shader
      - inputs: interpolated pixel color/attrs
      - access to texture data
      - output: pixel color
       Deferred Shading
• Rasterize first
• Store shading parameters instead of
  color in each pixel
• Second pass shades each pixel
• Shading depth complexity equals one
• Fat framebuffer
        Deferred Shading
1. Store shading params: T d p x  d s x
         addr   d   pixel   p   x
  T                                  model
         data   d           s

2. Shade pixel: C xs  p T xs
                    xs
  C                                  screen
         data   p     s     T   xs
   Model Space                       Texture Map



                 Plot using u,v
                 Fill using s,t,r



Texture Atlas                        Replace s,t,r

Shading                              w/proc. RGB




                 Apply texture map
Texture Atlas Shading
1. Store solid texcoord: T d u x  d s x
         addr       d             u
   T                                           model
         data       d             s

2. Shade solid texcoord: T d u  p T d u
         addr       d             u
   T                                           texture
        data    p       s   T   data   d   u

3. Map onto surface: C d p x  T d u x
          Texture Coordinate
          Shaders
•   Standard Texturing: Cdpx  T d u x
•   Pass Thru: Cdpx  d u x
•   Dependent Texture: Cdpx  T’ T d u x
•   Environment map: T u x  pS s x
•   Environment Mapped Bump Mapping
       C d p x  T d ((u x) + (T’ d u’ x))
         Shadow Map
• Render from eyepoint shadowed
                   Cdpxdpsx
• Render from eyepoint illuminated
                  C’ d p x  d p s’ x
• Render from light source (unshaded)
                     Cl d pl x  d x
• Backproject to construct shadow mask
           a C xs  (z C xs) > (z Cl pl p-1 xs)
• Use to blend shadowed and lit images
      C xs  (a C xs)*(C xs) + (1 – a C xs)*(C’ xs)
         Shadow Volume
• Shadow volume: x’, stencil buffer: s C
• Render scene
                Cdpxdpsx
• Store shadow vol. visibility in stencil
   sCdpx  (sCdpx) OR ((z d p x’) > (z Cdp x’))
• Use stencil to combine shadow image
         C d p x  (s C d p x) ? (d p s’ x)
          Newer Stuff
•   Gouraud: C d p x  d p s x
•   Phong/Bump: C d p x  p d s x
•   Subdiv/Displace: C d p x  p s d x
•   QSplat: C p d x  p s d x

      Moral: Push the delta right (!?)
          Conclusion
• Real-time procedural shading
  causes us to rethink the
  graphics pipeline

• Grammar provides a concise
  method to describe and
  compare new pipelines

• Future work: classification,
  new pipelines, sampling

						
Related docs
Other docs by juanagui