Debugging Billboard Clamping

Hi there! I’ve been trying to work on the bug from this github issue: Race condition in billboard clamping · Issue #10191 · CesiumGS/cesium · GitHub

I’m super new to contributing so this has been quite a challenge. So far, I’ve been a able to locate “why” the bug is happening but not “where.” The “updateFunction” on line 1141 on Billboard.js is updating with the wrong clamped value, making the billboard clamped when it should not be.

Some other unusual behavior is also that if the browser is shrunk horizontally to half it’s size, the billboards actually work properly even after pressing “disable the depth test when clamped to ground” and going back to another mode. Once you zoom in, the billboard shifts to the wrong clamped value. This makes me think the bug might have to do with zooming in or camera height/distance. It would be easier to try and check where “updateFunction” is called, but there are only 2 instances I see where it is called and I’ve confirmed it doesn’t go through updateFunction in those cases. I also noticed that it was set as a callback function, but those aren’t called either.

I’m a little stuck on this bug now. Is there somewhere in the code that relates the camera distance to the globe and calls some sort of update for certain distances? I’ve checked other areas of the code outside of Billboard.js and BillboardCollection.js and couldn’t see how they could call just the updateFunction that was inside Billboard.js.

Any guidance would be appreciated, and thank you for your time!

Actually, I figured this out!

Hi @Yuri_Chen,

Thanks for posting a follow-up! I am glad that you were able to figure out your issue. If possible, it would be great if you could share some of the resolutions with the rest of the community. That would make this post a great resource for folks who have similar issues moving forwards.