Download presentation

Presentation is loading. Please wait.

Published byLesley Terry Modified about 1 year ago

1
Two Methods for Fast Ray-Cast Ambient Occlusion Samuli Laine and Tero Karras NVIDIA Research

2
Ambient Occlusion in Theory Occlusion of incoming ambient light Light from these directions reaches the surface Light from these directions does not reach the surface

3
What It Looks Like

4
Ambient Occlusion in Practice Use limited range for occlusion Otherwise everything would be occluded in indoor scenes Also faster to calculate because of finite radius Use falloff function to smooth the transition Do not solve analytically Theoretically doable, but would be ridiculously expensive Solution: Monte Carlo sampling 256 – 1024 samples is usually enough

5
Ray Casts for Ambient Occlusion Cast a number of rays from the point to be shaded Determine occlusion distance, apply falloff, sum In reality use a fancy low-discrepancy sampling pattern

6
Using Shadow Rays Shadow rays are usually faster than ordinary rays Enough to detect any intersection, not necessarily closest one Can do if we bake falloff function into the rays

7
Our Contributions Two methods for calculating ambient occlusion faster One for rasterization-based renderers One for ray tracing -based renderers No approximations as in screen-space methods Up to ~10–15x speedup over state-of-the-art ray caster

8
Common Part: Occlusion Masks Both methods keep occlusion status in bit masks Occlusion of all rays from one point = one bit mask Utilize precalculated look-up tables for fast update of these masks Update occlusion of all rays at once! Resembles LUTs of hemispherical rasterization paper by Kautz et al. 2004, but more versatile

9
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

10
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

11
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

12
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

13
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

14
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

15
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

16
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

17
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

18
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

19
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

20
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

21
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

22
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

23
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

24
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

25
Occlusion Look-up Table Store binary plane vs. ray occlusion Plane normal & distance from origin 3D table Clever parameterization to avoid singularity at the center

26
Occlusion of a Triangle Combination of four occlusion masks

27
Using Pre-Calculated Masks 128 3 look-up table is sufficiently accurate To calculate occlusion of one triangle vs. all occlusion rays from a single receiver point Transform triangle into coordinate space of receiver point Calculate triangle plane and edge planes (trivial) Fetch occlusion masks for all planes Combine fetched masks together (binary AND) Combine with current occlusion status (binary OR)

28
Method 1: Rasterization First render depth and normal buffers For each occluding triangle, rasterize bounds for region of influence For each fragment inside the region of influence, calculate triangle vs. point occlusion and accumulate in frame buffer Use logic op blending into occlusion bits in frame buffer Bounding the region of influence similar to ambient occlusion volumes by McGuire 2010

29
Rasterization

30
Two choices for bounding volume If triangle is large, construct hexagonal prism If triangle is small, construct hemispherical billboard Bounding the Region of Influence Large triangle Small triangle

31
Fragment Culling Hardware depth test culls fragments where receiver point is behind the region of influence Many culling opportunities remain in fragment shader Receiver point in front of region of influence (approximate) Receiver point outside bounding sphere of region of influence Triangle faces away from receiver point Receiver point too far from triangle plane Triangle completely below the horizon of the receiver point Culling tests in shader cuts the number of actually processed fragments by about 80–90%

32
Level of Detail Optimization Far away occlusion doesn’t care about small details in the occluding surface Therefore, we could use simplified geometry for larger occlusion distances Nearby occlusion always has to be done using original geometry! Split occlusion distance to various ranges, apply progressively more and more aggressive simplification as the distance grows Can yield 30–140% speedup with tolerable error, depending on the scene

33
Level of Detail Example

34
Method 2: BVH Traversal Assume that BVH for scene triangles is available Find occluding triangles by traversing the BVH around the neighborhood of the receiver point Similarities to packet traversal of Wald et al. 2007.

35
BVH Traversal Algorithm Maintain cumulative occlusion mask for all AO rays during traversal When making traversal decision, estimate the occlusion potential of current node’s children Occlusion potential = Number of currently non-blocked rays that are blocked by the bounds of the node If occlusion potential is zero, don’t go there If both children are eligible, first process the one with greater potential Try to build up occlusion quickly to be able to cull remaining nodes

36
Calculating Node Occlusion Mask Tried out two kinds of node bounds Boxes Find silhouette edges, use same mask LUT as for triangles Tight bounds, but expensive to compute (6 lookups) Spheres Determine direction and apex angle Needs a separate 3D LUT for finding the occlusion mask Conservative bounds, but cheap to compute (1–2 lookups) Found out that spheres gave best overall performance

37
Triangle Culling After reaching BVH leaf node, process each triangle Apply culling rules for each triangle Triangle completely below the horizon of the receiver point Triangle faces away from receiver point Receiver point too far from triangle plane Receiver point outside bounding sphere of region of influence If triangle survives, compute occlusion mask and apply to current ray occlusion status

38
Results Compared against our previous GPU ray caster [Aila and Laine 2009] Added optimizations for shadow rays Performance measured in Mrays/second Used various ambient occlusion radii

39
Results

40
Results: Scalability

41
Results: Correctness

42
Future Work Soft shadows from area light sources

43
Thank You Questions

Similar presentations

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google