Three.js buffergeometry disappears after moving ca

2019-01-28 09:59发布

问题:

My buffergeometry disappears after moving the camera to close. You can also see that in drawcalls Three.js example that has TrackballControls. In my case it's alot worser. My points disappear at the distance from 0 to 400 and my lines disappear at the distance from 0 to 100. My objects are working fine with a simple geometry but not with a buffergeometry. I found out that it has something to do with the centroid of the buffergeometry. I tryed to use different camera's, to change the camera range and still it doesn't work. How can I stop my objects to disappear after moving the camera?

Update

Got it working by adding linesMesh.frustumCulled = false; and removing geometry.computeBoundingSphere();. Thanks for all the help.

回答1:

Three.js thinks your object is outside the frustum. Add the line

linesMesh.frustumCulled = false;

and it should stop it from disappearing.



回答2:

I suggest that you check your camera's .near clipping parameter. Objects close to the camera will naturally be cut off.