Hi Cesium team,it seems the AO postprocess stage does not work correctly in the scene.
Sandcastle Link:AO example
Browser:Google Chrome 131.0.6778.70
CesiumJS Version:Cesium 1.126
Operating System:Windows 10 Professional 22H2 19045.5011
Hi Cesium team,it seems the AO postprocess stage does not work correctly in the scene.
Sandcastle Link:AO example
Browser:Google Chrome 131.0.6778.70
CesiumJS Version:Cesium 1.126
Operating System:Windows 10 Professional 22H2 19045.5011
HI @WANGShuai ,
Thanks for your post and for using Cesium.
Comparing your code to our sandcastle example for Ambient Occlusion Cesium Sandcastle the only different I see is that our example sets camera.frustum.near = 1.0
. Setting this in your code seems to suppress unwanted effects.
The odd part is the default for camera.frustum.near is 1.0, it seems to be getting set to 0.1 in your scene, and I am not sure why.
Please let us know if this seems to fix your problem, I am also curious to know why near is not set to the default.
Best,
Luke
The value of 0.1 is set in the scene constructor. So the answer to why this is happening is: Because this_logDepthBuffer
is true
But I don’t know the answer to the questions of why this is set when this flag is
true
and why this has the effect that can be observed here. The near/far
range that is used there is huge, and I could imagine that this causes all sorts of trouble with screen-space computations, but the details remain to be investigated…
@Marco13 is correct that frustum.near
defaults to 0.1
when we are using a log depth buffer (log depth is default). This does reduce the precision of the depth buffer somewhat, but the error is usually not significant. It really only shows up as a problem if we are doing advanced post-processing effects, like AO.
We discussed setting a default near plane of 1.0
for everyone. However, this would mean the camera would not render anything closer than 1 meter. So for example, if a user was navigating through a doorway in a first-person view, the door, the door frame, and the light switches next to it would all disappear just as the user approached the door.
This is why we kept the default at 0.1
for the near plane, and simply added a recommendation to use larger values when AO is enabled. See Distance-based Gaussian weighting for Ambient Occlusion by jjhembd · Pull Request #12316 · CesiumGS/cesium · GitHub if you want to read more of the discussion.