Tuesday, May 22, 2007

Horizon-based Distance Culling

There are many techniques used to reduce the visual complexity of the viewable scene in order to improve a game's performance (fps, freeing cycles for other calculations, etc). This is an especially important issue in multiuser games that simulate a world-like space, since "world" implies having rather large spaces. All the typical techniques are applicable, such as distance-culling, fog, level of detail, limited sight-lines, etc. One technique that I think has been under-utilized is creating a world with actual curvature to it.

The earth itself is approximately spherical with a radius of 6371km, resulting in a horizon at 4.7km for the average (1.7m) human. It should be possible to "bend" the terrain mesh of a world to give it a horizon far enough out to feel realistic but close enough to hide a fair amount of distance culling. For example, a spherical terrain mesh of radius 100km results in a horizon at approximately 583m (horizon = sqrt(2*r*h + r*r), where r is the radius of the sphere and h is the eye height of the viewer). Such a world has a surface area of 125660km square (area = 2 * pi * r * r), which is more than enough for any current game (World of Warcraft, for example, has been calculated to have about 200km2 land area, pre-Burning Crusade).

However, work needs to be done in determining how close the horizon can be pushed and still feel realistic. The above horizon of 583m means that a player moving at the speed of a typical human sprinter (approximately 10m/s) will reach objects at the horizon in somewhat less than a minute. The total circumference of such a horizon distance is 3.7km (circumference = 2*pi*r), which may not big large enough to make properly-scaled objects appear realistic. Tall structures with strong vertical lines may also suffer a distortion due to being set perpendicular to the ground that makes them appear to be tipped away from the viewer.

There are also several other obvious benefits to verisimilitude obtained by bending the terrain mesh to create a horizon besides concealing distance culling. Tall objects over the horizon, such as towers, large trees and mountains will gradually appear to the player as they approach. The top will become visible first, and the rest of the structure gradually revealed from top to bottom as the player comes closer instead of the typical distance pop-in of the whole object. Flying objects (birds, flying mounts, airships etc) will appear at the horizon and trace an arc across the sky instead of popping in at altitude in the distance tracing a straight line across the sky and popping out at a distance. Terrain relief (hills, mountains, even buildings) will better mask out other local high points (other hills, mountains, buildings). For example, if you are standing below the summit of a mountain you will not be able to see the summit of an adjacent, even taller mountain on the other side of your mountain, just as in the real world.

No comments: