|Prev: Notes and Optimizations
It is possible to optimize the view frustum culling process taking in account spatial and temporal coherence. These optimizations we’re first proposed by Assarsson and Moller. Do have a look at their paper if you’re really into this.
If an object is rejected by a plane, and the camera moves slowly it is likely that the object will be rejected by the same plane again. If this is true then the first plane to be tested should be the one that led to rejection in the previous frame. To implement this strategy it is enough to store in each object the last plane of rejection.
This reasoning can be detailed observing the type of movements performed by the view frustum. Assarsson and Moller consider the two possibilities separately: rotation and translation.
This approach is based on the camera’s rotation. When an object is rejected by the left plane and the camera rotates a little to the right then the object will be out of frustum again.
However this approach should be used with caution. If the camera keeps rotating to the right, the object will eventually be inside the view frustum again.
If the rotation is not restricted to any of the axes it is hard to keep track of it, hence it is probably simpler to use a timestamp, and keep the record of the plane only for a small amount of time.
If an object is rejected by the near plane, i.e. it is behind the view frustum, and the camera translates forward then that object will be out of the view frustum for sure.
When the view frustum is translated, the planes are translated by a certain distance (a different distance for each plane in the general case). Lets assume that when the view frustum was translated, the left plane was translated by d, where d is the signed distance between the left planes in two consecutive frames. Then if a bounding volume was at a signed distance d0 in the last frame, in the present frame the distance from the bounding volume to the left plane will be d’ = d + d0.
This approach can only be applied if the distances from the bounding volume to the planes are kept, which requires extra storage to keep them. Furthermore, since the bounding volume is not necessarily tested against all the frustum’s planes (or tested at all) these distances may be unknown.
Several methods and optimizations we’re presented in this tutorial. There are many solutions and often they present a trade-off between the accuracy of the test and its computational expense.
One thing to have in mind is that plane extraction is going to be performed once every time the camera moves. On the other hand testing is going to be performed n times per frame (n being the number of things to test) and n can be quite large. So to optimize view frustum culling, the main focus should be on the testing side, as this is going to take the lion’s share of the time taken to perform view frustum culling.
To properly tune an application requires testing and measuring times, and a good degree of feeling. Hope the tutorial has helped someone out there to get a better grasp of the view frustum culling process.
|Prev: Notes and Optimizations