Gladiator Deferred Shading Demo - PowerPoint PPT Presentation

1 / 14
About This Presentation
Title:

Gladiator Deferred Shading Demo

Description:

25 skinned characters (64 bones each), 5k-15k tris each, tangent space bump mapped ... Shrek Xbox made heavy use of 2-3 layer detail albedo texturing (modulation and ... – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 15
Provided by: richgel
Category:

less

Transcript and Presenter's Notes

Title: Gladiator Deferred Shading Demo


1
Gladiator Deferred Shading Demo
2
Raw Stats
  • 150k tris/frame at 30Hz
  • 25 skinned characters (64 bones each), 5k-15k
    tris each, tangent space bump mapped
  • Single scene pass deferred shading, four material
    channels albedo, detail albedo, gloss, normal
  • Up to 24 real-time omnidirectional lights
  • Unified per-pixel lighting model two-hemisphere
    area, directional, and omnidirectional (point)
    lights
  • Fully dynamic shadow volumes, CPU silhouette
    extraction from low poly (400-1000 tri) meshes
  • Near-linear light accumulation (gamma 1.3), 2x
    overbright lighting, hardware gamma ramp converts
    from gamma 1.3 to sRGB (http//www.srgb.com)

3
Deferred Shading Observations
  • A significant fraction of the total scene time
    can be spent just rendering attributes.
  • Reducing the number of scene passes frees up lots
    of CPU/GPU time for other stuff shadows, lights,
    etc.
  • Why not the holy grail ONE scene pass?
  • For a single pass scheme to work on Xbox, all
    attributes must be all packed into a single
    32-bit ARGB color. Were dont have the luxury of
    MRTs (Multiple Render Targets).

4
Deferred Shading Observations
  • What are the minimum attributes needed for decent
    per-pixel lighting with bump mapping?
  • Depth, Albedo, Normal, Gloss
  • For a workable solution the attributes must be
    packed after texture filtering. Without this
    requirement the problem is much easier point
    sample prepacked textures.
  • At first glance this doesnt seem possible How
    to pack all attributes needed for decent
    per-pixel lighting into one 32-bit ARGB color
    using the Xboxs texaddrops (Texture Address
    Operations) and combiners?

5
Identifying Limitations and Whats Really
Important
  • In order to pack all attributes so tightly its
    necessary to identify the perceptual importance
    of each attribute.
  • The pack/unpack process described here was
    heavily influenced by the Xboxs GPU
    architecture, NTSC (Never the Same Color) display
    output, and the genre of our demo.

6
Looking at the Problem Backwards
  • Unpacking
  • Assume the packing problem has been solved How
    to quickly unpack the attribute data during the
    screenspace lighting passes into a form suitable
    for lighting in the combiners?
  • Xbox supports 2D dependent texture lookups using
    AR or GB as the source texture coordinates. So it
    seems natural to pack albedo/gloss into one pair
    of components (AR) and the normal into the other
    set (GB).
  • Unpacking in the light shaders will be easy, and
    not require any combiners.
  • Requires two precomputed lookup tables (256x256
    2D texture maps).

7
Know Your Attributes
  • Albedo Packing
  • Good albedo textures shouldnt have much if any
    burned-in lighting
  • With per-pixel lighting their influence on the
    final look doesnt justify a full 24-bit color in
    many cases 16-bits or even less can look OK
  • Detail Texturing
  • Shrek Xbox made heavy use of 2-3 layer detail
    albedo texturing (modulation and compositing), so
    it seems prudent to require some type of detail
    map support.
  • The packing process must occur after the texture
    lookups, ruling out texaddrop (lookup table)
    assisted packing.

8
Know Your Attributes
  • Gloss Packing
  • Some type of per-pixel or per-material gloss
    (specular intensity) control is necessary.
  • The grayscale gloss maps used in Shrek where
    usually plain, so scrunching gloss down to a few
    bits (2-4) shouldnt be a show stopper.
  • Normal Packing
  • Output is constrained to a unit length vector.
    Its possible to discard the magnitude of one
    component and recover it later
  • z zSign sqrt(1 x x y y)
  • Sign of discarded component can be stored as a
    single bit.
  • Z Recovery op can be done in the 2D dependent
    lookup used for normal unpacking.

9
Attribute Packing Pixel Shader
  • Samples albedo and tangent space normal maps
  • Cubemap renormalizes iterated geometric normal
  • Cant renorm. the iterated tangent and binormals.
    They arent as perceptually important anyway.
  • Rotates normal from tangent to view space in the
    combiners
  • Approximately renormalizes rotated normal
  • Equation n n .5 (1 - dot(n, n))
  • Packs normal into Output.GB
  • Packs albedo and gloss into Output.AR
  • Note Shader detailed here only supports 1
    albedo map. Detail texturing is an exercise for
    the reader.

10
Attribute Packing Pixel Shader Final Bit Layout
-1 of 2
  • Output AR BRGL 4462
  • Output GB ZYX 178
  • Albedo can be encoded as sRGB or YCbCr
  • 4 bits for Albedo.B/Cb and Albedo.R/Cr
  • 6 bits for Albedo.G/Y
  • 2 bits for Gloss (L)
  • Normals are packed in view space
  • 1 bit for Normal.Z (sign)
  • 7 bits for Normal.Y
  • 8 bits for Normal.X

11
Attribute Packing Pixel Shader Final Bit Layout
2 of 2
  • Output Color AAAA AAAA RRRR RRRR GGGG
    GGGG BBBB BBBB
  • Packed Bits BBBB RRRR GGGG GGLL ZYYY
    YYYY XXXX XXXX

Key to Packed Bits B Blue/Cb (4 bits) R
Red/Cr (4 bits) G Green/Y (6 bits) L Gloss (2
bits) X Normal.X (8 bits) Y Normal.Y(7
bits) Z Normal.Z sign (1 bit)
12
Load Time Texture Map MungingSimplifies
Packing Pixel Shader
  • The color components of the albedo/normal
    texture palettes are rearranged, or duplicated to
    the alpha channel.
  • Albedo Texture Components
  • albedoTexture.A Blue or Cb
  • albedoTexture.R Green or Y
  • albedoTexture.G Gloss (specular intensity)
  • albedoTexture.B Red or Cr
  • Normal Texture Components
  • Alpha channel of tangent space normal maps
    contains Y
  • normalTexture.A Y
  • normalTexture.R X
  • normalTexture.G Y (ignored by packing shader)
  • normalTexture.B Z

13
Packing Pixel Shader Inputs Are Swizzled
Simplifies Packing Pixel Shader
  • T1, V0, and V1 are the rows of a 3x3 tangent
    space to view space rotation matrix
  • The components of each row are inverted in the
    vertex shader to simplify packing
  • T1 View Space Normal.zyx
  • V0 View Space Tangent.zyx
  • V1 View Space Binormal.zyx

14
Shader Flowchart
  • John Brooks (CEO, Blue Shift, Inc.) made me
    delete it!
Write a Comment
User Comments (0)
About PowerShow.com