2. 2 | A 2.5D culling for Forward+ | Takahiro Harada
AGENDA
ï§âŻForward+
â⯠Forward, Deferred, Forward+
â⯠Problem description
ï§âŻ2.5D culling
ï§âŻResults
3. 3 | A 2.5D culling for Forward+ | Takahiro Harada
FORWARD+
4. 4 | A 2.5D culling for Forward+ | Takahiro Harada
REAL-TIME SOLUTION COMPARISON
ï§âŻRendering equation
ï§âŻForward
ï§âŻDeferred
ï§âŻForward+
5. 5 | A 2.5D culling for Forward+ | Takahiro Harada
FORWARD RENDERING PIPELINE
ï§âŻDepth prepass
â⯠Fills z buffer
ï§âŻPrevent overdraw for shading
ï§âŻShading
â⯠Geometry is rendered
â⯠Pixel shader
ï§âŻIterate through light list set for each object
ï§âŻEvaluates materials for the lights
6. 6 | A 2.5D culling for Forward+ | Takahiro Harada
FORWARD+ RENDERING PIPELINE
ï§âŻDepth prepass
â⯠Fills z buffer
ï§âŻPrevent overdraw for shading
ï§âŻUsed for pixel position reconstruction for light culling
ï§âŻLight culling
â⯠Culls light per tile basis
â⯠Input: z buffer, light buffer
â⯠Output: light list per tile
ï§âŻShading
â⯠Geometry is rendered
â⯠Pixel shader
ï§âŻIterate through light list calculated in light culling
ï§âŻEvaluates materials for the lights
1
2
3
[1,2,3][1] [2,3]
7. 7 | A 2.5D culling for Forward+ | Takahiro Harada
CREATING A FRUSTUM FOR A TILE
ï§âŻAn edge @SS == A plane @VS
ï§âŻA tile (4 edges) @SS == 4 planes @VS
â⯠Open frustum (no bound in Z direction)
ï§âŻMax and min Z is used to cap
8. 8 | A 2.5D culling for Forward+ | Takahiro Harada
LONG FRUSTUM
ï§âŻScreen space culling is not always sufficient
â⯠Create a frustum from max and min depth values
â⯠Edge of objects
â⯠Captures a lot of unnecessary lights
9. 9 | A 2.5D culling for Forward+ | Takahiro Harada
LONG FRUSTUM
ï§âŻScreen space culling is not always sufficient
â⯠Create a frustum from max and min depth values
â⯠Edge of objects
â⯠Captures a lot of unnecessary lights
0 lights
25 lights
50 lights
10. 10 | A 2.5D culling for Forward+ | Takahiro Harada
GET WORSE IN A COMPLEX SCENE
0 lights
100 lights
200 lights
11. 11 | A 2.5D culling for Forward+ | Takahiro Harada
QUESTION
ï§âŻWant to reduce false positives
ï§âŻCan we improve the culling without adding much overhead?
â⯠Computation time, memory
â⯠Culling itself is an optimization
â⯠Spending a lot of resources for it does not make sense
ï§âŻUsing a 3D grid is a natural extension
â⯠Uses too much memory
12. 12 | A 2.5D culling for Forward+ | Takahiro Harada
2.5D CULLING
13. 13 | A 2.5D culling for Forward+ | Takahiro Harada
2.5D CULLING
ï§âŻAdditional memory usage
â⯠0B global memory
â⯠4B local memory per WG (can compress more if you want)
ï§âŻAdditional computation complexity
â⯠A few bit and arithmetic instructions
â⯠A few lines of codes for light culling
â⯠No changes for other stages
ï§âŻAdditional runtime overhead
â⯠< 10% compared to the original light culling
14. 14 | A 2.5D culling for Forward+ | Takahiro Harada
IDEA
ï§âŻSplit frustum in z direction
â⯠Uniform split for a frustum
â⯠Varying split among frustums
(a) (b)
15. 15 | A 2.5D culling for Forward+ | Takahiro Harada
FRUSTUM CONSTRUCTION
ï§âŻCalculate depth bound
â⯠max and min values of depth
ï§âŻSplit depth direction into 32 cells
â⯠Min value and cell size
ï§âŻFlag occupied cell
ï§âŻA 32bit depth mask per work group
A tile
16. 16 | A 2.5D culling for Forward+ | Takahiro Harada
FRUSTUM CONSTRUCTION
ï§âŻCalculate depth bound
â⯠max and min values of depth
ï§âŻSplit depth direction into 32 cells
â⯠Min value and cell size
ï§âŻFlag occupied cell
ï§âŻA 32bit depth mask per work group
7 7 7 7
7 7 7 2
7 7 2 1
7 2 1 0
Depth mask = 11100001
A tile
0 1 2 3 4 5 6 7
17. 17 | A 2.5D culling for Forward+ | Takahiro Harada
LIGHT CULLING
ï§âŻIf a light overlaps to the frustum
â⯠Calculate depth mask for the light
â⯠Check overlap using the depth mask of the frustum
ï§âŻDepth mask & Depth mask
â⯠11100001 & 00011000 = 00000000
Depth mask = 11100001
Depth mask = 00011000
18. 18 | A 2.5D culling for Forward+ | Takahiro Harada
LIGHT CULLING
ï§âŻIf a light overlaps to the frustum
â⯠Calculate depth mask for the light
â⯠Check overlap using the depth mask of the frustum
ï§âŻDepth mask & Depth mask
â⯠11100001 & 00110000 = 00100000
Depth mask = 11100001
Depth mask = 00110000
19. 19 | A 2.5D culling for Forward+ | Takahiro Harada
CODE
Original With 2.5D culling
20. 20 | A 2.5D culling for Forward+ | Takahiro Harada
RESULTS
21. 21 | A 2.5D culling for Forward+ | Takahiro Harada
LIGHT CULLING
22. 22 | A 2.5D culling for Forward+ | Takahiro Harada
LIGHT CULLING + 2.5D CULLING
28. 28 | A 2.5D culling for Forward+ | Takahiro Harada
CONCLUSION
ï§âŻProposed 2.5D culling which
â⯠Additional memory usage
ï§âŻ 0B global memory
ï§âŻ 4B local memory per WG (can compress more if you want)
â⯠Additional compute complexity
ï§âŻ 3 lines of pseudo codes for light culling
ï§âŻ No changes for other stages
â⯠Additional runtime overhead
ï§âŻ < 10% compared to the original light culling
ï§âŻShowed that 2.5D culling reduces false positives