-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Closed
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-FeatureA new feature, making something new possibleA new feature, making something new possible
Description
Description
- If you hold your hand up with your fingers together, out of the line of sight of any direct lighting, you will notice that where your fingers meet each other gets gradually darker. This can also be noticed in edges/corners of rooms where walls meet. This is called ambient occlusion.
- I think of ambient light as light that has bounced around many times of many surfaces and so it comes from all directions. But, if some directions in the hemisphere tangent to a surface are blocked, then ambient light cannot reach the surface at that point from those directions and so that point on the surface is dark than one where the hemisphere is unimpeded.
- This subtle shadowing of ambient light adds significant visual depth and enhances geometric detail which can otherwise look quite flat
Solution
- There are many approaches to calculating ambient occlusion. Occlusion of a model's surfaces by itself can be baked into occlusion textures. Occlusion between different objects in the scene, for example a cupboard against a wall, can be done in real-time as part of the real-time rendering effects.
- A simple approach called Screen Space Ambient Occlusion involves running a prepass to populate the depth buffer as well as to calculate normals and write them into a texture. A second pass is run which, for each fragment calculates the world position of the fragment from the fragment uv and the depth and projects back to world space. More samples are taken from the depth buffer from within a hemisphere oriented along the surface normal. The percentage of samples that have depth buffer values closer to the camera gives an approximation of the percentage of directions that are occluded.
- The current state of the art technique is called Ground-Truth Ambient Occlusion (GTAO) and is a drop-in replacement for SSAO but is a significantly more complicated horizon-based technique that builds on Horizon-Based Ambient Occlusion and enhanced versions thereof.
- https://github.com/superdump/bevy/tree/ssao-pipelined
- A partial implementation of SSAO including the depth/normal prepass, and SSAO pass using a low discrepancy sequence hemispherical sampling kernel in tangent space (wow, that's a mouthful - just imagine a unit hemisphere pointing along +z), and randomly rotating that sampling kernel using blue noise, but no blur, plus bugs
Next Steps
- Rebase, fix bugs, implement blur, make PR
tylerkayser, yaskhan, fstxz, necedema and Inspirateur
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-FeatureA new feature, making something new possibleA new feature, making something new possible
Type
Projects
Status
Done