I’m trying to update a project from Babylon 4.2.2 to the latest 5.33.0 version. While most things seem to work, I encountered a weird rendering problem when the camera is very close to a mesh. The mesh itself won’t be rendered anymore, however reflections and node positions are still updated when orbiting the camera. I have noticed this issue since the first betas of v5.
I captured a video illustrating the issue:
Unfortunately I’m currently not at liberty to share the actual project. I also failed to isolate the issue in a dedicated playground.
I realize this is isn’t ideal, but maybe someone can point me in the right direction?
Thank you!
When you are zoomed in, it seems the lighting is changing when you move the cursor(?) The light is following the cursor?
It seems to be rendered but with a different lighting(?).
You can try to use Spector (https://spector.babylonjs.com/) and see if something is different when you are zoomed in and when you are not.
Thanks for your reply!
The scene uses an ArcRotateCamera, so I’m using the cursor to orbit around the camera origin. When I click the red marker, the camera origin moves to the point I just clicked and the radius (i.e. distance to the origin) is decreased.
I’m still using the cursor to orbit around the new origin, but the mesh is not updated/rendered correctly anymore. The reflections however are still updated, which makes it look like the lighting is changing.
Hope that helps, sorry for the confusion.
At 18-19s the shading is changing whereas nothing moves, that’s a bit strange…
That’s hard to diagnose more… Would you have a similar video when things are working as expected, to better see what are the differences?
Yeah, that’s the issue I’m trying to fix.
- 0:00-0:07 Orbiting the camera left and right, everything works as expected.
- 0:07-0:09 Camera position changes and is now very close to the mesh.
- 0:09-0:22 Orbiting the camera left and right again, just as before. But now, the mesh is not updating correctly, but the camera still moves and reflections on the material are updated accordingly. Sometimes the mesh is updated for a few frames.
- 0:22-0:31 Increasing camera distance and again orbiting left and right, mesh is updated correctly again.
- 0:32-0:36 Returning to the initial camera position, orbiting left/right, everything still works.
I think it may be related to occlusion culling or something similar. When the camera is very close, it may be inside the bounding box of the mesh and the mesh is considered invisible to the camera and thus not updated.
I played around with all the mesh properties related to occlusion culling, but haven’t been able to solve the issue yet. The issue is not present in Babylon v4.
Try to use Spector for a frame that works and for another that doesn’t. You will see if all the meshes are rendered in both cases or if it’s something else.
I wasn’t able to gain any useful insight from Spector.
However, the issue now seems to be solved by setting needDepthPrePass
to true
on the mesh material. Not sure why, but I’ll take it.
1 Like