260 likes | 270 Views
GEARS: A General and Efficient Algorithm for Rendering Shadows. Lili Wang 1 , Shiheng Zhou 1 , Wei Ke 2 ,Voicu Popescu 3. 1 State Key Laboratory of Virtual Reality Technology and Systems, Beihang University. 2 Macao Polytechnic Institute, Macau. 3 Purdue University, West Lafayette. Contents.
E N D
GEARS: A General and Efficient Algorithm forRendering Shadows Lili Wang1, Shiheng Zhou1, Wei Ke2,Voicu Popescu3 • 1State Key Laboratory of Virtual Reality Technology and Systems, Beihang University • 2MacaoPolytechnic Institute, Macau • 3Purdue University, West Lafayette
Contents • Motivation • Related work • Algorithm • Acceleration • Results • Limitations • Conclusion 1
Motivation • Shadow for Realistic rendering • Area lights give soft shadows Area light Point light 2
A pixel Motivation • Ray Tracing is a solution, multiple rays for each sample. But slow. • Challenge is to estimate what fraction of an area light source is visible from each of the surface pixel samples in real time. Area light Lots of shadow rays per pixel 3
Related work • shadow simulation methods • Screen-space percentage closer soft [MOHAMMADBAGHER M.et al.2010] • Percentage-closer soft shadows [FERNANDO R.2005] • Approximate soft shadows with an image-space flood-fill algorithm [ARVO J. et al.2004] • shadow approximation methods • Highquality adaptive soft shadow mapping. [GUENNEBAUD G.et al.2007] • Microquad soft shadow mapping revisiteds. [SCHWARZ M. et al. 2008] • Packet-based hierarchal soft shadow mapping.[YANG B. et al.2009] [MOHAMMADBAGHER M.et al.2010] • [YANG B. et al.2009] 1 4
Related work • Accurate soft shadow methods • Alias-free shadow maps [AILA T. et al 2004] • Samplebased visibility for soft shadows using alias-free shadowmaps [SINTORN E. et al.2008] • Efficient ray traced soft shadows using multi-frusta tracing[BENTHIN.C. et al. 2009] • Visibility sampling on gpu and applications [EISEMANN E. et al. 2007] [AILA T. et al 2004] • [SINTORN E. et al.2008 1 5
A pixel Algorithm - Basic solution Area light Replace the shadow rays With rendering all triangles on visibility bit mask Construct a camera frustum containing sample rays Fractional visibility per pixel can be computed Area light Lots of shadow rays per pixel Resterize triangles on visibility bit mask 6
Algorithm - Basic solution Replace the shadow rays With rendering all triangles on visibility bit mask Construct a camera with pixel sample as its eye and the light as its image plane Fractional visibility per pixel is computed as the percentage of unoccluded light samples visibility mask (resolution) Render triangles Light source Shadow caster triangles Pixel sample as a camera 7
Algorithm • GEARS algorithm • Compute the output image without the soft shadows • Unproject each pixel p in I0I1 to pixel sample P • Assign all tris. to pixel samples P.(acceleration is introduced later) • For each P, compute the frac. visibility vp of L0L1 • Construct camera • Render with PL0L1 all blocking triangles • Compute vp as the percentage of unoccluded light samples • Add the contribution of light L0L1 to each pixel p of I0I1 using the computed fractional visibility vp. 8
Acceleration- Finding potential triangles Assign all tris. to pixel samples is naïve Time Memory A small portion of triangles are blocking We want to find the potential blocking triangles per pixel HOW? 9
Acceleration- Finding potential triangles • Generating grid cells in light space • Triangles and samples are transferred in a light space • Assign triangles to all the cells that are touched by the projection of area light • Projecting pixel samples with camera and assign them to the grid cells. • Pixels in a same cell shares the blocking triangles • Spatial coherence 10
Acceleration- Generating grid cells Generating light camera : View frustum of camera contains 3-D AABB of all sample pixels. The far plane is given by the farthest corner of the 3-D AABB. 11
Acceleration- Triangle to cell assignment A triangle is assigned to : All grid cells for which the triangle might block the light. Established a mapping from triangles to cells by pairs (triID; cellID) . 12
Acceleration- Invert the mapping Creates an array of pairs (triID; cellID) by calculating all the cellsN touched by the triangle Mapping needs to be inverted to be able to retrieve the triangles that potentially block a given cell. computed in parallel by radiax sorting 13
Acceleration- Rasterize potential triangles • For a given pixel we find the potential triangles in the sorted array from the begin to the end of belonging cell. • Rasterize • Construct a camera with pixel sample as its eye and the light as its image plane • Scan line rasterization • Bit mask is computed • Fractional visibility is computed as the percentage of unoccluded light samples 14
Result - Quality • Soft shadows rendered with GEARS compared to that of ray tracing – No Difference ! Our Method Ray-tracing 15
Result - Quality Soft shadows rendered with GEARS compared to that of ray tracing, dynamic scene with tree moving in winds – No Difference ! Our Method Ray-tracing 16
Result - Quality • Video 17
Result - Quality • Quality dependence on resolution of visibility masks –Better results with higher resolution 4x4 8x8 16x16 32x32 18
Results - Performance Our method is between 10 and 25 times higher than ray tracing. 19
Results - Performance • Quality comparison between GEARS and ray tracing for equal time performance ray tracing GEARS GEARS ray tracing 20
Results - Performance • Average frame rate for our test scenes for various output image resolutions 21
Results - Performance • Frame rate for various visibility mask resolutions. 22
Limitations • Blockers have to be large enough for their projection to be detected. • Regular grid is used which is an inefficient modeling of non-uniform sampling • Edges of blocking geometry exhibit some degree of temporal aliasing • Cannot efficiently support a set of disparate point light sources 23
Conclusion • GEARS is an algorithm for computing Soft Shadows • General: support fully dynamic scenes, scenes without restrictions • Efficient: fast to compute and tight • Accurate: guaranteed to render all triangles that block the light 24
Thanks Q&A