I'm wondering what metrics I could use to decide upon the visibility of a 3D object in VR or other 3D applications and what advantages each has.
1 Answer
Visibility for culling (or passing to the render pipeline) is very sensitive to false negatives. False positives are not a big deal because when rendering the Z buffer will take care of that.
This means that one very simple metric is simply assuming that it's always visible. If any other metric gives too much overhead than simply processing the object requires then this is a good fallback. For example in a redering api with command buffers rebuilding the command buffer would be too expensive compared to the processing required to render a single object to warrant it.
The next option is to see if the object is in front or behind the camera, This can be done with a dot product with the view vector and the forward most point of the bounding volume of the object. If it's negative then the object is behind the camera and you can skip it.
The next is using the view pyramid. From the camera you extrude the frustum and do a collision check between it and the object. If it collides then the object is visible. Instead of 1 plane you now check against 4 and the object must pass All 4 to be considered visible.
Next you can take into account when the object is fully occluded by another object. This can be done by various methods. With static geometry you can partition the world and say for each section which other sections you can see from it. You can also ask the GPU to do occlusion queries which basically means "did any fragments of these render commands pass the depth test". But getting the information back from the GPU typically has a decently long latency, by which time the camera may have moved.