-
The complexity of the model: the memory required for segment
representation in the scene graph and the time necessarily for loading
the segment;
-
The status of the segment, which can be 0, if the segment
is not in the memory, and a positive value, if the segment is present in
the memory.
The mapping function, executed each frame in the process
P0, evaluates the distance of each segment towards the observer
position, based on the position and dimension information stored in segment
control block. Depending on this distance, a segment switch operation is
initiated, namely an attachment or a detachment operation.
An attachment operation consists in the following
steps:
-
Load virtual segments from the corresponding file on the
disk and create the graph that is the model of the segment.
-
Connect of the segment in the scene graph, by creation of
a link from scene root node to the root node of the segment.
-
Update the status of the segment in the corresponding segment
control block.
A detachment operation consists in the following steps:
-
Disconnect the segment from the scene graph.
-
Delete all segments data and free the memory space.
-
Update the status of the segment in the corresponding segment
control block.
To avoid frequently segment switch operations, the mapping
is executed with a distance hystheresis. Two values are defined, swichIn
and swithOut, and, in this moment, we can consider that switchIn
= F and switchOut = switchIn + D
, where D > 0.
Several problems arise in the execution of the mapping
function, for dynamic segment switch: asynchronous loading of segments
and the virtual scene granularity. These problems will be discussed in
the following subsections.
4.1 Asynchronous Loading of Segments
In previous subsection we considered the loading of a
new segment as a short operation, which can be executed immediately, when
the mapping function is called, in the first pipeline stage process (P0).
This is not a real situation. Depending on the complexity of the segment,
the loading operation can require a time much more then the duration of
a frame. A typical frame time is 33 msec (for a 30 Hz real time image generation)
and the loading of a segment can require about few seconds. It is impossible
to stall the whole pipeline processes while reading the file, because the
constant update rate would be lost. The solution is to start a new process,
an asynchronous loading process, which is executed concurrently with pipelined
processes. The loading process can be executed in two modes:
-
As a process with lower priority then the pipelined processes,
which is launched in the free intervals of each frame.
-
As a process executed on a single processor, which must be
restricted for this process.
|
The loading process is triggered by first stage process
P0, in the mapping function. It will be executed over many frame
intervals, using the elapsed time between the end of a pipelined process
and the start of a new frame, or on a separate processor restricted for
loading process (PL). It doesn’t disturb the real-time execution,
if it is triggered in advance, such that the required segment is present
in memory, when it is needed.
The increasing of the loading time requires considering
a higher value for swichIn distance. We denote with:
F – the far plane distance in viewing frustum;
ti – the medium
loading time in asynchronous loading mode of the segment Vi
v – the maximum moving speed of the observer in
the virtual scene.
Then, the switchIni distance of the
segment Vi can be evaluated as:
switchIni = F
+
tiv.
In other words, the loading process for a segment must
be triggered in advanced, such that, when the segment is at a distance
equal the far distance of viewing frustum, the segment is already present
in memory, and can be used for image generation.
The switchOuti distance of the segment
Vi
must
be established such to avoid frequently segments switching. An acceptable
condition for switchOuti is that a detachment operation
do not be required during a loading:
switchOuti > switchIni+
tiv.
According with this implementation, the mapping function
is modified correspondingly: when a virtual segment is needed to be attached,
the loading process is launched, but the connection in the scene graph
and updating of the segment control block is executed later, after the
segment was loaded. The status of the loading process is stored
in a shared location, accessed by process P0 and loading process
PL, using a mutual exclusion mechanism [5].
4.2 Virtual Scene Granularity
The dynamic loading of segments described previously
made no assumptions regarding the available memory space for segments loading.
In limited memory space condition, which is the most probably situation,
it is not enough that the mapping function decides to load a new segment,
it is also necessarily to exist memory space for loading it. The mapping
function must be modified such that, a loading operation will be launched
only if the memory available space is equal or greater than the memory
complexity of the new segment. The loading must be delayed until the required
memory space is obtained by deleting another segments.
If the loading operation of a segment is delayed with
many frames, it is possible that the loading process finishes when the
distance (D) of the segment towards the observer position is less
than the far distance of the viewing frustum (F), which means that
the segment wasn’t present in the memory and in the scene graph when it
was needed. These situations produce artifacts in the generated image,
because the segments appearing in the image suddenly and too late. |