Enabling ambientOcclusion creates vertical artefacts
Hi Cesium-Team,
I have a simple map with a terrain and some 3D-Tiles layers. When I activate the ambientOcclusion with the folloginw code:
const ambientOcclusion = scene.postProcessStages.ambientOcclusion;
ambientOcclusion.enabled = true;
ambientOcclusion.uniforms.bias = 0.5;
ambientOcclusion.uniforms.stepSize = 1;
ambientOcclusion.uniforms.blurStepSize = 1;
The maps has rendering artefacts.
With occlusion:
Without occlusion:
Am I doing something wrong or is it a bug? Thanks !
Reproduction steps
...
Sandcastle example
No response
Environment
Browser: Both Chrome and Firefox CesiumJS Version: 1.133.0 Operating System: Windows
Hi @remyguillaume, thanks for this report!
Can you share a Sandcastle link that replicates the issue? Here is how to do it:
- Go to https://sandcastle.cesium.com/
- Edit the "JavaScript code" tab with your JavaScript code
- Edit the "HTML body & CSS" tab (if needed)
- Click on the "Share" button and copy the provided URL
Ambient occlusion sometimes creates noise from precision artifacts in the depth buffer. For bird's-eye views like this, you can improve the depth precision by shifting the near frustum plane further away. For example, the Ambient Occlusion Sandcastle has a line like this:
viewer.camera.frustum.near = 1.0;
Hi @jjhembd ,
I've created a sandcaslte where the error can be reproduced : https://sandcastle.cesium.com/#c=fVRdb9sgFP0rKC9Npho7zUfTNI0mtdvTpE5KtidLE4ZrmxaDBThZOvW/72InVZN+PNnAOZfDPQdkVRvryRfCHLkFJ5uK5NZUJO3xdpT2rlOdam6082QjYQuW3BAN2z2a/m7n+gf8rdGeSQ027Q2uDzzHQQPSOj5th23ZOCbrUjqikEGcURtwxJdAamsyBdU8IPYkziqwjOa2cR631cCCkCFN2kJtSerBWtz8pzUbKVqhbMukP0jtPutjEA3H/WVV/6z0vnbzOB4JWoChAjY0LyTlyjSCZo7yMt5vgPL+7uLkYjZOhhlEbJLzaDyZJhEbz66ifDrOx5MZF1Mm/kzis8GrDnqpwIG/r73EMQr8l2pCKvZXVk214hZAr2rG4Zu1xs5JQifnASB2mlWSvwV428BniO+M+4C7TPVzK+OoFaO7dafnwyZ0x+6sjVvxMdtEWRYVkLFGQGRKDRH+Ykse4NHH+wPSB2f02fnJeQdBKUWDdb/vB+Rm2SWD1lZW0kt0nzIhcOl1y1iVSdD+nnPVOKyCTduzjPPoIopzK8+KQD6BYpXTKQqaYbQEVgm9ew/RaJkbWzmaSRYsQhM+hTkP9Uo+hYAPP6+nGrs6Br/ckK30T2AV0+IWyW1222goowvpsdPoIZ1cJdNkOmoNV8zv58e4MLmcja/G7UIJsij9nFwkSUKTg+8nt0jt1qbfbiDAealZ8Gf+clGY9fjH9KgNxh0UmCrXD3DyVip90Xj+IWIv9kNAJzqsYkaeB9e9897C+Z2CZZj7KrtXqsGEUoq3sKqxImYxa/gjho07FxKziA+UhZAbIsXNO68S4Yo5hyt5o1RwIu0tFzHij2jKMCF1cb8JKncBUg6XP7pJSukixuFbljdGZcy+qvgf
But actually adding viewer.camera.frustum.near = 1.0; solves the problem, thanks a lot for your response !
Since this looks to be a usage issue solved by setting the near frustum plane, I'll go ahead and close this issue
Since this looks to be a usage issue solved by setting the near frustum plane, I'll go ahead and close this issue
The problem has not been solved. After adding the code, it still flickers when moving away from the ground.
Hi @CandyACE thanks for your follow up. I see the following behavior without a flicker when viewer.camera.frustum.near = 1.0; is added. Can you elaborate on what you are seeing and share details so we can determine if this persists?
https://github.com/user-attachments/assets/4565803d-8280-4c17-a9df-a3b045fce1b4
It's hard to see. I found it easier to reproduce when the window was large (maximized), and zooming out very far very quickly.
The following is a capture of that (only a tiny part of the window, to keep the size reasonable), and I extended the duration of one of the offending frame to 5 seconds, to illustrate the effect: