Computing Bent Cone

In rendering world, there are several article that discusses about bent cone. For example Bent Normals and Cones in Screen Space and also in GPU Pro 3: Screen-Space Bent Cones: A Practical Approach.

In this post, I wanted to share how I compute bent cone (bent normal and max cone angle). The paper Bent Normals and Cones in Screen Space actually discusses how you compute bent normal and max cone angle (although it's a bit math-y). Here, I want to present how I compute it.

Computing bent normal is quite easy, basically you just shoot rays from your sampling point (pixel/vertex) and average the unoccluded rays (and normalize it).

For max angle, it turns out we can correlate it with AO:
Let:
   A = Half Opening of Cone Angle
   AO = Ambient Occlusion Value

AO = UnoccludedArea / TotalArea

Where:
TotalArea = Hemisphere Area
          = 2 * pi * r * r
UnoccludedArea = Area covered by Solid Angle 2A
               = Solid Angle 2A * r * r
               = 2 * pi * (1 - cosA) * r * r

Hence:
AO = 1 - cosA
cosA = 1 - AO
This basically means, to compute the cone angle, it's enough to compute AO.

Comments

Popular posts from this blog

World, View and Projection Matrix Internals

GDC 2015 Links

BASH: Reading Text File