Hi all,
I’ve recently been trying to implement a simple AABB culling system - I’m aware of the OnBecameVisible() and Renderer.isVisible functions, however what I’m trying to cull does not have a renderer component; basically, a large node so I can ‘batch-turn-off’ all the objects inside (as part of a Quadtree).
My problem is - there are certain situations where I’m getting false-positives (stuff is not being culled when it should be) and I’m at a loss to explain it. The code snippet below can recreate the problem (attach it to a simple cube or object with bounds) - the false positive I’m getting is shown in the image.
Has anyone else encountered this behaviour? Is there anything I can do about it? I have implemented my own frustum tests, however I end up with much the same result.
public class CameraCull : MonoBehaviour
{
[SerializeField]
Camera m_camera = null;
// Update is called once per frame
void Update()
{
this.renderer.enabled = GeometryUtility.TestPlanesAABB(GeometryUtility.CalculateFrustumPlanes(m_camera), this.collider.bounds);
}
}
