• No se han encontrado resultados

Although simulation LOD was inspired by, and many aspects of it are taken from, graphical LOD, the two have significant practical differences. In this section we describe three of the most pressing issues.

4.2.1

Heterogeneous resources

Real-time rendering is not memory-limited. That is, arbitrarily complex scenes can be rendered with a fixed amount of graphical memory resources. The representation of those scenes which is presented to the graphics card, of course, must be capable of holding the entire scene, but can be streamed from larger memory stores on a per-frame basis.1 There is,

1Limiting the need for per-frame data streaming can dramatically improve graphical performance, but this

is generally treated as a separate problem from graphical LOD, as most rendering systems do not provide the application explicit control over the caching of data in graphics memory. Additionally, the use of “texture

as far as graphical LOD is concerned, exactly one resource: time.

In contrast, simulation can become impractical by taking up an immense amount of memory, rather than by taking too long to complete. For instance, large-step simulation of out-of-view objects, such as that described by Chenney [2001], can be used to amortize simulation costs over many frames, minimizing the simulation time with large amounts of objects; but these objects’ state must still be held in memory at all times, and the “potential state-space” which is maintained for each object can consume a large amount of memory. As an extreme example, even simply maintaining the full name of each person in a simulation of the population of New York City would take over 100 megabytes of memory, but the per-frame computational cost of simulating the change of these names would be quite low (usually occurring, after all, only upon birth or marriage).

A more commonly occurring illustration of this problem is found in the maintenance of changes to the world. Modern video games which include firearm combat as a central game mechanic generally show holes or dents in objects which are hit by bullets. Over the course of a game, millions of shots may be fired. The simulation cost of these bullet holes is essentially zero, as once created they are never changed. However, to maintain them throughout the entire course of the game would take a large amount of memory. Likewise, moved furniture, dented mailboxes, etc. must be reset eventually in order to keep memory usage under control.2

A simulation LOD system must consider at least these two independent costs of de- tail. Past approaches to reactive graphical LOD have relied on there being only one con- strained resource, either by using algorithms which do not support multiple resources atlases” to minimize rendering pipeline stalls means that the set of textures held in graphics memory changes infrequently, usually only when moving between levels or zones.

2A piece of furniture, of course, requires the same amount of information to identify its position whether or

not the player has moved it. However, by resetting an area of the world to its initial state, this information can be drawn from the high-capacity read-only storage used to distribute the game, rather than from per-saved-game storage.

[Funkhouser and S´equin, 1993], or by adjusting a single global level of detail modifier to maintain the framerate near a specified level [Hitchner and McGreevy, 1993], and are therefore inadequate for use in simulation LOD.

4.2.2

Short- and long-term LOD selection

In graphical LOD, the cost of LOD changes is minimal. Consider a simple proactive graphical LOD system which switched an object between two levels of detail based on its distance from the viewer, fading the change over several frames to reduce the “popping” effect. If the viewer were to hover on the threshold of the distance and pace slightly, causing the object’s level of detail to vacillate, the only runtime cost would be that of processing the fade. (There may be a penalty to realism caused by the frequent fading, but this is easily managed by applying hysteresis to the transition distance.)

In contrast, the computational cost and the cost to realism from switching LODs may be severe in a simulation LOD system. For instance, alibi generation (a technique for upgrading the realism of a single agent, to be described in chapter 5) takes a significant amount of time for each upgraded agent; a single frame of alibi-ful simulation is vastly more expensive than a single frame of alibi-less simulation. These ramping-up (or ramping-down) costs are justified by amortizing over many frames: once the alibi has been generated, alibi-ful simulation is only slightly more expensive than alibi-less simulation, and the alibi must only be generated once.

Simulation LOD should ideally be considered on a long-term basis, as opposed to the frame-by-frame allocation of a graphical LOD system. But reactive graphical LOD depends, to a large extent, on frame-by-frame allocation. Reactive graphical LOD which relies on measured framerates must have the ability to “experiment” with different levels of detail in order to maintain the accuracy of its predictions, by perturbing the level of detail of an object for a single frame and measuring the results; but these experiments are not feasible for

simulation LOD. Heuristic reactive LOD does not suffer from this issue, but in the context of simulation LOD it raises difficult questions of optimal resource allocation on a long-term basis.

4.2.3

Levels and transitions

Because graphical detail is drawn on a frame-to-frame basis, there are no constraints on transitioning between levels – the levels of detail available for rendering an object during a particular frame are independent of which levels of detail were chosen for the object in the past. In contrast, transitioning from one particular simulation strategy to another may not only be expensive, as explained in the previous section, but may not even be possible at all.

As an example, consider a vehicle simulation, which can simulate cars either as simple kinetic objects moving along predetermined lane lines, or as physically realistic bodies capable of changing lanes or even going off-road. Transitioning from the first level is straightforward: The initial position, orientation, and velocity of the physical body are copied from the simple kinetic object, and other state parameters such as steering angle are calculated to continue the vehicle’s immediate trajectory. But transitioning in the other direction – from physical body to kinetic object – may not be feasible. If a vehicle is off-road, changing lanes, or otherwise off the predetermined lane lines, it is impossible to transition in a way which preserves the object’s identity and state.

Another example serves to demonstrate both the usefulness of transitions and the dangers of executing them in a short-sighted manner. Consider a simulation – of any sort, really, but the vehicle one will do – when there are an additional two levels of detail: “frozen”, in which the entity is immobilized and not simulated until it comes back into view, as in Chenney [2001], and “removed”, in which the entity is removed from the world entirely.3 In the

3The latter level is conceptually murky – lack of existence as a state – but its implementation is straightfor-

short term, the two levels have equal benefit, since neither would be chosen for a vehicle which was on-screen. And clearly the “removed” level has lower cost: “frozen” requires a per-frame visibility test to unfreeze at the appropriate time, and allocated memory to store its state, while “removed” of course requires nothing. By this algebra, objects would never be frozen, only removed, a clearly na¨ıve strategy.

Because transitions may be one-way, or otherwise sparsely connect levels of detail, the decision to perform one must take into account the future transitions which would be available, and the likelihood that they would be necessary. As in the example above, it is sometimes worthwhile to spend computational resources not for immediate gain, but as maintenance on an option to later transition to a level which would otherwise be unavailable. It may not be possible to do this in an optimal manner – the problem is one of planning under uncertainty, a notoriously computationally intensive task [LaValle, 2006].

A final factor complicating the idea of a “transition” is that a single entity may have several simulation components, which may be partially or completely independent. For instance, a vehicle entity may vary in the fidelity of its driving physics, as well as in the quality of the AI used to steer it. If each feature has three different levels of detail, the vehicle as a whole has nine possible levels of detail. It is tempting to avoid this combinatorial explosion by disassociating the components from each other, but this may not be possible: If the lowest AI level requires simple, skid-free dynamics which are not provided by the highest physics level, only eight levels for the vehicle should be considered. (As we shall see later, there are other reasons to consider only a small subset of the possible combinations.)

Documento similar