Clipping Issues

I’ve been scratching my head a bit on trying to fix this issue. I created a playground for it and it works perfectly fine there. So this is the issue, I’m working on a large environment using a first-person controller using the camera-based off the BabylonJS docs on how to create a controller with an ellipsoid.

Here is the playground: and it includes the same imported mesh I’m using as the environment. For simplicity, I just used a free camera with no collisions. I can move far away from the mesh itself and still render it just fine, but in my own project, I can’t even walk around within the same environment before the mountain “sphere” starts to clip. I even changed back to a basic free camera in my project trying to replicate the playground and I still get this even near the center of the model:

I don’t understand what the difference could be. I even changed the maxZ to ridiculous amounts like 50,000 and it didn’t make a difference which makes me think there is something else I’m missing. Has anyone else experienced this? What could be causing the issue?

Ok, I think I found the issue. Ironically enough after I posted this here I found what was causing the issue, although still trying to figure out how to fix it. When I added in the environment texture as the skybox the clipping became apparent. When I removed it I had no clipping issues whatsoever. I’m assuming there’s some conflict between these. I might just change the skybox to be a basic sphere with a sky texture, but is it possible to use the environment texture without affecting the maxZ or the camera?

Here is the example with collisions -

Check the size of your skybox, it should be a bit bigger than your ground mesh.
Or use .env texture as environment texture (you’ll need it anyway for PBR materials).

Really nice mountains, by the way.


Ok, that’s probably it. I didn’t adjust the size of the skybox, I just added in the env texture. The mountains were part of an asset pack I’m using. Thanks, marking solution!

Edit Just to add to this in case anyone else runs into this as well, it was indeed the size of the skybox. I ended up adjusting it’s size to 2000. Here is a code snippet:

// third parameter scale
 scene.createDefaultSkybox(envTex, true, 2000);