045-049
045-049
Wolfgang Müller-Wittig† 1
Gerrit Vo߇ 1
1 Centre
for Advanced Media Technology
Nanyang Technological University
Singapore
Abstract
Current scenegraph systems, especially systems used to build general purpose virtual reality systems, are trailing
game engines and similar specialized systems in terms of the adaption of new rendering methods like the different
real-time shadow algorithms. This paper analysis the fundamental OpenGL state abstraction layers present in
current scenegraph systems with respect to their influence on the adaption of new and complex rendering algo-
rithms.
Categories and Subject Descriptors (according to ACM CCS): I.3.6 [Computing Methodologies]: Computer Graph-
ics Methodology and Techniques I.3.7 [Computing Methodologies]: Computer Graphics Three-Dimensional
Graphics and Realism
c The Eurographics Association 2007.
46 Wolfgang Müller-Wittig & Gerrit Voß / Challenges for modern Scene-Graph Systems
In general the part of a scene graph system which change can be applied. After wards it has to fill up again be-
is responsible of preparing the scene for processing by fore the nominal performance can be reached. If these state
the graphics card is called rendering backend. It has the changes happen too often it might not be possible to fill up
responsibility to convert the scenes as given by the user the pipeline completely, and in the worst case waste all the
into the final image. The rendering backend does so by benefits of the pipelined architecture.
traversing the scene graph, collecting the visible geometries
and passing them on to the underlying hardware. During But not all problems with state changes can be attributed
this process it is the responsibility of the backend to find an to the simplicity of the hardware. Some are caused by limited
order of the geometries which allows the best utilization of resources that have to be managed, like texture memory and
the given hardware. texture caches. Texture are usually stored in special, high
performance memory, the texture memory, on the graphics
board itself. Furthermore the active areas of the textures are
In the following we will describe the abstraction layers stored inside a special cache, the texture cache, as close as
found in current OpenGL based scene graph systems. possible to the processing unit. Like any other multi-level
cache system changing its contents to often will decrease
the overall performance. Thus the second task of the scene
2. Challenges for current Systems graph system is to take care of managing the state. Specif-
Graphics hardware as abstracted by OpenGL and thus seen ically to minimize the number of state changes in order to
by scene graph systems can be viewed as a state machine avoid pipeline stalls and cache pollution.
by which the primitives are processed and transformed to Scene graphs therefore include state sorting facilities as
form the pixels of the final image. The state variables which part of their draw operation. Current systems like Open-
describe how the primitives are drawn include light and SceneGraph, OpenSG or OpenGL Performer [RH94] iden-
material parameters, textures and blending, and customized tify a State by a unique identifier and use a bucket sorting
shaders. strategy to group primitives by their associated state. This
way primitives sharing the same state are drawn directly af-
ter each other without the need of a state change. The con-
2.1. OpenGL Abstraction
cept of using a unique state identifier for the sorting pro-
This layer has two main tasks. The first, which is visible to cedure was based on the observation that each StateChunk
the programmer, is to provide access to the state variables. occurred exactly once inside the State and thus the prim-
Modern scene graph systems like OpenSG [RVB02] or itives where likely to share the complete State instead of
OpenSceneGraph [OB05] group similar variables together single StateChunk and thus sorting by chunks would be an
to form logical clusters, for example all texture, material nearly never used overhead. Unfortunately this assumption
or light information are grouped together. These are called broke down with the appearance of multi textures and shader
StateAttribute (OpenSceneGraph) or StateChunk (OpenSG), programs from OpenGL version 1.3 on. Now it was com-
where a set of them is called State and fully describes how mon to share one or more textures between States or use the
the associated primitives will be drawn. The benefit of same shader program and only vary the shader parameters
grouping them in a logical way is that the programmer has between different primitives as the multi texture example in
a better understanding which variables belong together and figure 1 illustrates.
must be manipulated in a synchronized way.
The OpenGL state of each of the tunnel segment building
blocks (ceiling, floor, left and right wall) contains a color tex-
The second task relates to the way modern graphics hard- ture and a light texture (see figure 2). Blended together they
ware is build. The OpenGL graphics pipeline is not only put allow the simulation of the complex lighting environment.
into hardware but in order to achieve real-time performance In order to create a complete tunnel n segments are joint to-
for complex models it has to be pipelined, so that different gether. Due to the varying light textures each of the n floor
parts of the rendering pipeline work independently of each elements, for example, is seen by the existing state sorters as
other, like independent vertex and fragment stages. Further- having a unique, independent state even if all floor elements
more each of the stages them self contains multiple units share the same color texture and other state settings. This in-
working in parallel, like the 24 fragment units of a NVidia ability to utilize information about shared StateChunks dur-
Geforce 7800 GTX. To be able to build these parallel units ing the sorting process may result in the following worst case
and the pipelines in hardware they have to be rather simple. rendering order. First each element of segment i (floor, ceil-
As a number of different pieces of geometry may be in op- ing and walls) is drawn followed by each element segment
eration at any given time, changing the state, and thus the i + 1. This segment by segment processing continues until
way the units operate, has to be synchronized with the data segment n. Thus activating each of the color textures n times.
flow through the pipeline. As simple hardware cannot do that In comparison a StateChunk aware sorter will be able to first
the pipeline has to be, at least partially, empty before a state draw all floor elements followed by all ceiling, all left and
c The Eurographics Association 2007.
Wolfgang Müller-Wittig & Gerrit Voß / Challenges for modern Scene-Graph Systems 47
all right wall elements, activating each color texture exactly or depth texture have to be stored in order to reuse them in
one time. later stages.
Again the simple bucket sorting approach of the render-
ing backend can neither handle the ordering constraints of
the traversals nor provide storage for the temporary results.
A simple example for multi stage algorithms are shadow
maps [SKW∗ 92], figure 5. This algorithm creates real-time
shadows by first rendering the scene as seen from the light
position (Stage 1, figure 3). The resulting depth buffer is
stored in a texture and reused later. The next stage (Stage
2, figure 4) renders the scene as seen by the camera but
only the ambient color terms are active in order to generate
the shadow colors. The last stage (Stage 3, figure 5) draws
Figure 1: Multi texture environment. the scene from camera perspective with diffuse and specular
lighting enabled. The result from Stage 1 is used to decide
whether a pixel is lit or inside the shadow.
c The Eurographics Association 2007.
48 Wolfgang Müller-Wittig & Gerrit Voß / Challenges for modern Scene-Graph Systems
c The Eurographics Association 2007.
Wolfgang Müller-Wittig & Gerrit Voß / Challenges for modern Scene-Graph Systems 49
References
[MT04] M ARTIN T., TAN T.: Anti-aliasing and continu-
ity with trapezoidal shadow maps. In Proceedings of the
2004 Eurographics Symposium on Rendering (2004), Eu-
rographics, pp. 153–160.
[OB05] O SFIELD R., B URNS D.: Openscenegraph, ref-
erence guide. Online, http://www.openscenegraph.org,
2005.
[RH94] ROHLF J., H ELMAN J.: Iris performer. a high per-
formance multiprocessing toolkit for real-time 3d graph-
ics. In Proceedings of SIGGRAPH 1994 (1994), Glassner
A., (Ed.), Computer Graphics Proceedings, Annual Con-
ference Series, ACM, ACM Press / ACM SIGGRAPH,
pp. 381–395.
[RVB02] R EINERS D., VOSS G., B EHR J.: Opensg - basic
conepts. OpenSG 2002 Workshop, January 2002.
[SAFL99] S EGAL M., A KELEY K., F RA -
ZIER C., L EECH J.: The OpenGL graph-
ics system: A specification (version 1.2.1).
ftp://ftp.sgi.com/opengl/opengl1.2/opengl1.2.1.pdf,
1999.
[SALB04] S EGAL M., A KELEY K., L EECH J., B ROWN
P.: The OpenGL graphics system: A specification (ver-
sion 2.0). http://www.opengl.org/documentation/
specs/version2.0/glspec20.pdf, 2004.
[SKW∗ 92] S EGAL M., KOROBKIN C., W IDENFELT
R. V., F ORAN J., H AEBERLI P.: Fast shadows and light-
ing effects using texture mapping. In Proceedings of SIG-
GRAPH 1992 (1992), Computer Graphics Proceedings,
Annual Conference Series, ACM, ACM Press / ACM
SIGGRAPH, pp. 249–252.
[VR06] VOSS G., R EINERS D.: Towards a Flexbile Back-
End for Scenegraph-Based Rendering Sytems. In Pro-
ceedings of Graphite 2006 (2006).
[Wel04] W ELSH T.: Parallax mapping. In Shader X3. Ad-
vanced Rendering with DirectX and OpenGL, Engel W.,
(Ed.). Charles River Media, 2004, pp. 89–95.
c The Eurographics Association 2007.