1 / 13

Summed Area Tables using Graphics Hardware

Summed Area Tables using Graphics Hardware. Simon Green, NVIDIA. What are Summed Area Tables (SATs)?. Pre-integrated texture representation Invented by Frank Crow, 1984 Each texel is the sum of all texels below and to the left of it

jasondlee
Télécharger la présentation

Summed Area Tables using Graphics Hardware

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Summed Area Tables using Graphics Hardware Simon Green, NVIDIA

  2. What are Summed Area Tables (SATs)? • Pre-integrated texture representation • Invented by Frank Crow, 1984 • Each texel is the sum of all texels below and to the left of it • Allows rapid box filtering (average) over any rectangle for a fixed cost • Based on the algebraic identity: (x+a)(y+b) – (x+a)y – x(y+b) + xy = ab

  3. Summed Area Table Summed area table Regular image

  4. Summed Area Table a (x, y+b) (x+a, y+b) (0, y+b) b (x, y) (0, y) (x+a, y) (0, 0) (x, 0) (x+a, 0) ab = S[x+a, y+b] – S[x+a, y] – S[x, y+b] + S[x, y]

  5. Original Image

  6. Summed Area Table (scaled)

  7. SATs on Graphics Hardware • Floating point textures have sufficient precision to represent SATs • Can decode SAT using a fragment program • Enables texture lookup with any width box filter for constant cost (4 texture lookups + math) • Amount of blur can vary from pixel to pixel (spatially variant)

  8. SAT Texture Decode // look up into summed area table texture// returns average of pixels in rectangle with corners (x,y) - (x+a,y+b)float4 texRECT_summedArea(uniform texobjRECT tex, float2 xy, float2 ab){ float4 r; r = f4texRECT(tex, xy + ab); // S[x+a, y+b] r = r - f4texRECT(tex, xy + vec2(ab[0], 0) ); // S[x+a, y] r = r - f4texRECT(tex, xy + vec2(0, ab[1]) ); // S[x, y+b] r = r + f4texRECT(tex, xy); // S[x, y] return r / (ab[0] * ab[1]);} • Bilinear lookup requires 4 bilinear lookups into float texture, followed by SAT decode • May also require clamping texture coordinates to avoid problems at edges

  9. Building Summed Area Tables using Hardware • For dynamic applications (e.g. depth of field), we need to be able to create SAT textures on-the-fly • Possible using render-to-texture • Sum columns first, and then rows • Each row or column is rendered as a line primitive • Fragment program adds value of current texel with texel to the left or below • Can be done using render to active texture, but warning - results undefined!

  10. Building Summed Area Table Original image Sum columns Sum rows • For n x m image, requires rendering2 x n x m pixels, each of which performs two texture lookups • Other algorithms may be possible

  11. Applications of SATs • Anisotropic texture filtering • Can be better than mip-mapping • Rectangle may not match projection of pixel exactly • Depth of field • Blur image of scene based on distance • Higher quality blur than using mipmaps • Soft shadows • Blur image of shadow based on distance from occluder

  12. Depth of Field Demo

  13. References • Crow, Frank. Summed-Area Tables for Texture Mapping. Proceedings of SIGGRAPH `84. In Computer Graphics 18, 3 (July 1984), pp. 207-212.

More Related