Line disappers as gets zooomed in
kurosh-z opened this issue · 4 comments
While implementing that shader in Unity I also had this problem. It seems that when you get too close and on some specific camera angles, the line flips to the other side and shows it back face, which wont be rendered. So my temporary solution, until I find the error in the code, is to disable backface culling for my lines.
It's probably due to the feature called frustumCulled
: https://threejs.org/docs/index.html#api/en/core/Object3D.frustumCulled
Check every frame if the object is in the frustum of the camera before rendering the object.
Otherwise, the object gets rendered every frame even if it isn't visible. Default is true.
The quicker solution will be to do that: mesh.frustumCulled = false
But the recommended solution will be to define a proper boundingBox
to your geometry: https://threejs.org/docs/index.html#api/en/core/Geometry.boundingBox
It's probably due to the feature called
frustumCulled
: https://threejs.org/docs/index.html#api/en/core/Object3D.frustumCulledCheck every frame if the object is in the frustum of the camera before rendering the object.
Otherwise, the object gets rendered every frame even if it isn't visible. Default is true.The quicker solution will be to do that:
mesh.frustumCulled = false
But the recommended solution will be to define a proper
boundingBox
to your geometry: https://threejs.org/docs/index.html#api/en/core/Geometry.boundingBox
Did you test it yourself ? Cause nothing seems to be changing with mesh.frustumCulled=false!
While implementing that shader in Unity I also had this problem. It seems that when you get too close and on some specific camera angles, the line flips to the other side and shows it back face, which wont be rendered. So my temporary solution, until I find the error in the code, is to disable backface culling for my lines.
Thanks @ardo314 for the important information. Set material.side = THREE.DoubleSide
solves the problem in my case!