feat: add screen-space ambient occlusion (SSAO)#993
Conversation
|
@hubbardp this is very exciting! Looks great from a quick look so far |
| // World→UV scale: wClip is -P.z under perspective and 1 under ortho. | ||
| float wClip = uProjection[2][3] * P.z + uProjection[3][3]; | ||
| float screenRadius = uRadius * uProjection[1][1] / (2.0 * wClip); | ||
| screenRadius = min(screenRadius, MAX_KERNEL_FRACTION); |
There was a problem hiding this comment.
In the link I posted, I can't see any visible difference when changing the radius value, I'm wondering if the value is always larger than MAX_KERNEL_FRACTION
|
For those who want to try the new functionality without building the code, it's running here: |
|
@hubbardp neuroglancer github actions are set up to create a deployment for every PR, available if you click "view details", it's definitely not obvious: |
|
What is the reason for disabling the effect on highlighted segments? It makes the highlighting rather jarring, though I haven't tested with the alternative behavior. |
I tried not disabling the SSAO darkening on highlighted segments, and they were too dark to see when highlighted. Personally, I like the brighter highlighting. I found that before SSAO, sometimes the randomly-chosen segment color was bright enough that the highlighting seemed barely distinguishable. |



Summary
Screen-space ambient occlusion (SSAO) simulates shadows on 3D mesh surfaces by darkening crevices and concavities where ambient light would be occluded. It adds depth cues that help us perceive shapes, and it makes the display more appealing. SSAO is an efficient post-processing effect applied to the perspective view after opaque geometry is drawn. See
src/ssao/README.mdfor more details and example images.Screenshots
Usage
qto toggle SSAO on and off.Known limitations
Performance
Algorithm
GTAO (Ground Truth Ambient Occlusion): Jimenez et al., "Realtime Strategies for Accurate Indirect Occlusion", SIGGRAPH 2016
Testing
src/ssao/shaders.browser_test.tscover composite math, GTAO and composite sentinel paths, blurring pass.