Computer Graphics & Geometry
T. Umenhoffer,L. Szirmay-Kalos , L. Szécsi, B. Tóth,
TU Budapest, Hungary
szirmay@iit.bme.hu
M. Sbert,
U of Girona, Spain
Contents
The light transport problem can be formalized by equation
Assigning the exit points to pixels is feasible only if the camera is static, which is usually not the case. Per-vertex representations constrain the density of sample points by the tessellation level, which limits the freedom of the modeler. Thus, we prefer the per-texel representation, which is the most flexible. It also has a drawback, namely the requirement of creating an appropriate texture atlas for the scene.
Having the pre-computed transfer operator, during the on-line part
of rendering, emission
is set according to the actual
lighting, and the finite element coefficients or the radiance of the exit points are obtained by a
vector-matrix multiplication. For other visible points, finite element reconstruction or
interpolation is used. Bi-linear interpolation of the per-vertex or per-texel representation is
especially effective since it is directly supported by the graphics hardware.
These approaches have two critical problems. The required storage
is usually huge and the assumption on a static scene is invalid.
The light transport operator is infinite dimensional, and even its
approximate representation requires very many discrete values.
If we have
finite elements, for example, surface elements, then
we need to store and compute
interactions, which is prohibitive if
is large.
On
the other hand, pre-computation is feasible only if scene parameters do
not change in time, which is a serious limitation of these
approaches.
To reduce the required storage, we may
The reduction of the number of exit points as well as the compression of the transport matrix mean that less data and interpolation should provide enough accuracy. This is feasible if these parameters have low-dimensionality or are of low-frequency in the spatial domain.
Several approaches have emerged that limit the freedom of object changes in order to make global illumination computations fast. These approaches can be classified from different points of view.
We may distinguish them according to whether they handle large-scale, medium-scale or small-scale light transfers.
Large-scale or global approaches transfer light between even the farthest points of the scene, but
to reduce the complexity, they also assume that local parts have homogeneous properties.
That is, large-scale methods attack the
complexity by reducing
, grouping elements and representing the whole
group by a single element.
Medium-scale or small-scale methods, also called local methods, transfer light only in the neighborhood, but cope with the high variance of
geometric and optical parameters. That is, local approaches address the
complexity
by considering only a group of elements at once. Medium and small scales are distinguished according to the level of geometry definition.
On medium-scale, the geometry definition is available.
On small-scale, the geometry is not directly defined, only approximated in forms of bump and displacement maps.
Pre-computation aided methods can also be categorized according to the variables of the transfer functions they pre-compute, i.e. whether these transfer functions connect light sources, directions, patches, points, texels, pixels, etc. Finally, we may distinguish methods that aim at the pre-computation of the full transfer, or only the indirect lighting.
If the scene is static, then radiance transfer coefficients between surface elements do not change. This has been recognized even in the context of finite-element based radiosity algorithms, where form factors could be computed only once. The price of this is that the required storage is a quadratic function of the number of patches. The idea has been further generalized to include arbitrary number of specular reflections with the introduction of extended form factors [Sillion and Puech 1994]. Fixing the light sources, the radiosity solution can be stored in a texture map, called the light map. Instead of the transfer functions, here usually per-texel irradiance is stored.
Pre-computed radiance transfer (PRT) [Sloan et al. 2002,Sloan et al. 2003] is a method to realistically render rigid bodies assuming that a single object is illuminated by low-frequency hemispherical image based lighting (i.e. it computes light direction to vertex radiance or light direction to texel radiance transfer functions). Its basic idea is that the incident illumination and reflected lighting functions are approximated by a finite element series, and thus lighting is expressed by vectors of coefficients multiplying the predefined basis functions (usually by spherical harmonics or wavelets). Then, during rendering, whenever the environment lighting changes, the reflected radiance can be quickly updated. The original idea has been improved in many different ways, including arbitrary BRDFs [Kautz et al. 2002], speeding up both preprocessing and rendering phases [Lehtinen and Kautz 2003], the application of principal component analysis to compress data [Sloan et al. 2003], the extension for closer lights [Annen et al. 2004], and the replacement of spherical harmonics by wavelets to allow high frequency environment maps as well [Ng et al. 2003].
To extend PRT to local lights, Kristensen et al. [Kristensen et al. 2005] discretized the incident lighting into a set of localized point lights (i.e. they used 3D light position to texel transfer functions. The main problem of this approach is that it further increases the dimensionality of the PRT solution, which is already quite high.
Mei et al [Mei et al. 2004] have proposed a solution to render both shadows and self illumination. Their method is based on Spherical Radiance Transfer Maps that have to be pre-computed for every vertex and hundreds of sampled directions. It is also assumed that lights are distant. The main caveat of the Spherical Shadow Map method is that shadow maps are rendered for the vertices. Then, when the illumination of a vertex is computed, sampled directions are tested against this map to see whether the environment map is occluded in that direction. This setup requires a large number of shadow maps, and could result in inaccurate per-pixel results, depending on the tessellation.
Radiance transfer precomputation has also been applied to translucent objects [Lensch et al. 2003], where the vertex to vertex radiosity transfer factors are stored and the response to an illumination is obtained by a finite element series using these factors as weights. Connecting the transfer factors to the vertices poses similar problems as in spherical transfer maps. The storage requirement is a quadratic function of the number of vertices, which prohibits complex or highly tessellated objects and requires well-shaped patches.
Light path reuse [Sbert et al. 2004] is a Monte Carlo technique to speed up animated light sequences assuming that the objects and the camera are still. Under these circumstances, light hit to pixel transfer function obtained in a frame may also be used in other frames if the ray between the light point and the first hit point is not invalidated by new occlusions. The combination of all paths in a single frame is governed by multiple importance sampling guaranteeing that the variance of the solution in a frame is close to what could be obtained if we dedicated all paths solely to this particular frame.
The light path maps method obtained the transfer function between uniformly sampled random points on the surface and points corresponding to texel centers [Szécsi et al. 2006], which is stored in a texture atlas. During real-time rendering, the direct illumination is obtained separately, and this texture atlas is taken advantage of to speed up the indirect illumination calculation. Note that this step requires visibility information between the light sources and entry points, but this is already available in the shadow maps obtained during direct illumination computation [Dachsbacher and Stamminger 2005].
Large-scale analysis does not allow very detailed surfaces since they would increase the complexity that should be considered at once beyond the possibilities of real-time rendering. Large-scale analysis is thus executed for the mean surface that is a simplified mesh. On the other hand, when detailed geometry is inspected, we may ignore distant parts of the scene and concentrate just on the local neighborhood since the illumination influence of a unit area surface diminishes with the square of the distance, thus distant points might be replaced by some ``average''. These methods usually examine the openness of points of the detailed surface. A point is said to be ``open'' in directions where the local neighborhood is not visible from it. In open directions an ambient illumination is assumed, which represents the ``rest''. In not open directions the ambient light is assumed to be blocked.
According to these considerations,
the reflected indirect illumination is approximated as
| (3) |
To account for color
bleeding, the obscurances formula has been modified to include the
diffuse BRDF of points visible from
[Mendez et al. 2005]:
Research efforts aiming at including meso-structure properties into material data are also related to this paper since these methods also store self-illumination capabilities compactly and combine them with the actual lighting. These methods are different extensions of texture maps, such as bi-directional texture functions [Dana et al. 1997,Suykens et al. 2003], or polynomial texture maps [Malzbender et al. 2001], that are usually obtained by a measuring process. The self-shadowing of meso-structure features can also be pre-computed and used in interactive rendering [Heidrich et al. 2000].
Combining small-scale and large-scale pre-computed approaches has been proposed for light maps. The basic problem of light maps that they store the irradiance of the mean surface, which cannot take into account the high-frequency variations of the normal vector and the detailed surface. The solution of this problem is to store the incoming radiance field, usually at a few sampled directions, and to obtain the reflected radiance on the fly [McTaggart 2004,Sloan 2006]. This approach can also be combined with ambient occlusion [Green 2007].
The method proposed by this paper builds upon previous work and combines their results in a novel way. According to frequency space behavior [Durand et al. 2005] the light transfer is decomposed to high-frequency direct lighting and indirect lighting that consists of high-frequency light source to surface transfer, low-frequency mean surface to mean surface transfer, high-frequency mean surface to detailed surface transfer, and finally high-frequency detailed surface to eye transfer.
Let us first examine the possibility of this decomposition problem formally. The global
illumination rendering is equivalent to the evaluation of high
dimensional integrals. Thus, from a mathematical point of view, the
decomposition corresponds to factorization of integrals. Let us
consider a simple one-variate integral of the product of two
functions:
In order to consider the frequency space behavior of functions
and
, let us mirror them onto the
line, and repeat it with
periodicity
. The resulting function is periodic, thus can be expressed by a Fourier series. Furthermore, the function is even,
so the Fourier series contains only cosine terms:
Exploiting the orthogonality of the cosine series, the integral of equation 5 can also be written as:
A typical game or virtual reality scene consists of a static environment (e.g. city, terrain, building, etc.) and of dynamic objects (e.g. enemy character, vehicle, weapon, etc.), where the static environment is usually much larger. The direct illumination of the static environment and of dynamic objects is strongly affected by the movement of dynamic objects, thus this is a temporally high-frequency component. The direct illumination is computed on the fly using shadow mapping. Indirect illumination of the static environment is built from light paths starting at the light source and including more than one scattering point either on dynamic or on static objects. If the light sources may move and may get close to the surfaces, then the intensity of the first hit points has high-frequency characteristics both temporally and spatially. However, due to the size differences of dynamic and static objects, the irradiance of paths arriving at a static surface area is roughly independent of the dynamic objects and is smooth. However, the reflected radiance caused by the average irradiance has also spatially high-frequency behavior since the variation of the normal vector and displacement mapped surfaces significantly modify the smooth irradiance. Finally the indirect illumination of the smaller dynamic objects is also of high-frequency in the temporal domain, so it should be approximated on the fly.
|
Based on the recognition of the possibility of factoring integrals and on the observations made on the typical game scenes, we propose the application of pre-computation only for low-frequency parts of the light transfer problem. The pre-computation is executed on two scales. The rest is computed on the fly.
The lighting problem is decomposed to several components (Figure 1). We identify the direct illumination, which includes the lighting of the detailed surface points visible from the camera, and also the lighting of the mean surface points that will be the first hits of longer light paths responsible for indirect lighting. As a part of the indirect illumination, we distinguish the mean surface to mean surface transfer, which connects hits of the rays emitted by the light sources and other points assuming only the mean surface, i.e. only simplified geometry. These connections may involve arbitrary number of multiple reflections. Finally, we also identify a mean surface to detailed surface transfer that describes the modulation of the average incoming radiance arriving at the hypothetic mean surface by the local properties of the detailed surface. Finally the direct illumination is added and the radiance reflected toward the eye is obtained.
The low-frequency mean surface to mean surface transfer is pre-computed between sampled entry points and points corresponding to the texel centers of a texture atlas, and the results are compressed by clustered PCA. We propose a novel sampling scheme for entry points that select them independently of the mesh complexity and also takes into account the a-priori knowledge of possible lighting configurations.
The medium-scale transfer is simulated by a modified obscurances method, which -- unlike ambient occlusion and scalar obscurances -- also takes into account the spectral properties of materials in the local neighborhood, but -- unlike the spectral obscurances -- still preserves the advantage of the local processing. Finally, small-scale transfer is handled by a simplified ambient occlusion algorithm.
The decomposition of the light transfer from light source to mean surface, mean surface to mean surface, and mean surface to detailed surface factors is possible because of the different frequency characteristics of these phenomena.
Concerning the temporal behavior of these transfers, those factors that are based on single rays are significantly affected by the movement of dynamic objects. Thus, these factors, including the light source to mean surface and the detailed surface to eye transfers, must be refreshed in each frame. However, those factors that are composed by connections of many light paths of arbitrary number of steps are rather invariant to the movement of dynamic objects. Even if some rays are invalidated by a moving objects, the other connection paths keep the transfer function from changing significantly. These factors, including the mean surface to mean surface transfer, and the mean surface to detailed surface transfer, can be assumed to be static and pre-computed.
To handle large-scale low-frequency transfer we use a modified light path maps method where the medium-scale transfers are ignored in the last step, the entry points are generated in a special way, and the transfer matrices are compressed by clustered PCA. The preprocessing step determines the indirect illumination capabilities of the static scene. This information is computed for finite number of exit points on the surface, and we use interpolation for other points. Exit points can be defined as points corresponding to the texel centers of the texture atlas of the surface, and the interpolation is provided by the bi-linear texture filtering feature of the graphics hardware.
The pre-processing algorithm consists of the following steps:
The first step of preprocessing is the generation of certain
number of entry points on the surface with some density
. These entry points will be samples of first hits of
the light emitted by moving light sources. Entry points are
assumed to have unit irradiance and are used as the start of a
given number of random light paths.
The simplest way to place entry points on surfaces is to sample them from uniform distribution. On the other hand, if we have some a-priori knowledge of the possible future lighting, then we can build this information into this probability. In games, we usually do have such information, for example, we know that the light source is flying close to the ceiling or is at the hand of a moving avatar.
Initially we place
test points
in the 3D space to sample the domain of
possible light positions. These sample points can be placed manually, or obtained
randomly from a distribution in 3D.
From each test point
we
sample
number of random or quasi-random directions from a
uniform density
which mimics the light source radiance. The
test point with the sampled direction defines a ray, which is
traced to look for a surface intersection. The found surface point
will be entry point
. The probability that we hit the
differential area
by a ray originating at test point
is
If we shoot
rays from each test point
, then
the density of entry points
is
The transfer function between entry points and exit points corresponding to texel centers is computed by random walk. Random light paths are initiated from the entry point according to BRDF sampling and Russian roulette, and the visited points of the generated paths are considered as virtual light sources [Keller 1997,Wald et al. 2002] and are connected to all those exit points that are visible from them. In this way we obtain a lot of paths originating at an entry point and arriving at one of the exit points.
The contribution of a path assuming unit irradiance at the entry point, divided by the probability of the path generation and of the entry point sampling, is a Monte-Carlo estimate of the indirect illumination. The average of the Monte-Carlo estimates of paths associated with the same entry point and exit point pair is stored.
A fundamental problem of the virtual light source algorithm (also called as instant radiosity or indirect photon mapping) is that the length of connection rays might be small, which leads to spiky artifacts at corners. In our multi-scale approach the multi-scale transfer is handled by another method, thus when implementing the virtual light sources algorithm short connection rays are ignored. This eliminates the double consideration of light transfer paths and also significantly improves importance sampling.
|
For a given entry point, the collection of exit points is a texture map, thus this data structure, called the light path map, or LPM for short, can be defined by as many textures as entry points we have (Figure 2).
The fundamental problem of pre-computation aided global
illumination algorithms is that they require considerable memory
space to store the transfer function coefficients. To cope with
the memory requirements, data compression methods should be
applied. A popular approach is the principal component
analysis (PCA) [Sloan et al. 2003]. The transfer function can be
imagined as separate
resolution textures for the
entry points:
. These textures
can be imagined as
number of points in an
-dimensional space.
|
To compress this data according to clustered
PCA, we first cluster those entry points that are close to each
other and are on similarly oriented surface, then apply PCA
compression separately for each cluster (Figure 3). PCA finds a subspace (a
``hyperplane'') in the high-dimensional space and projects the
th point
into the basis of its cluster
. Since the subspace has lower
dimensionality, the projected points can be expressed by fewer
coordinates, which results in data compression.
The process of PCA is depicted in Figure 4.
|
Let us denote the means and the basis vectors of cluster
by
, and
,
respectively. Each entry point
belongs to exactly
one cluster, which is denoted by
. Projecting into this subspace means the following
approximation:
To simulate medium-scale transfer, we first tried both the scalar obscurances and the ambient occlusion methods (Figure 5).
The problem of scalar obscurances and ambient occlusion is that
these methods ignore local color bleeding. The spectral obscurances method does simulate color bleeding but
for the price of global scene processing. In order to simulate medium-scale color bleeding but to keep
the advantages of local processing, we propose another obscurances formula that decomposes the directional domain into two parts,
an ``open'' part
where the visible points are farther than a threshold, and a ``closed'' part where
the visible point is closer. The sizes of these directional domains
are denoted by
and
, respectively.
Similarly to assuming that from far points an average ambient lighting is coming,
we assume that the BRDF of far points is replaced by the average BRDF.
Using this, the obscurances formula has the following form:
Small-scale geometry is represented by bump and displacement maps. To handle light transfer on this level, we can again use the obscurances method. However, since the geometry at this level is only locally and implicitly defined, further simplifications are worth taking.
Instead of the more complicated spectral obscurance measure, here we use the simpler ambient occlusion, which is approximated considering
the actual height and the perturbed normal.
Let us assume that the surface is displacement mapped and at each
point we have the normal vector of the mean surface
, the
normal vector of the shaded point
, and the height of the
current point
. We suppose that when
is 0, the point is on
the top of the surface, and when
is 1, then the point is at
the bottom of a wedge.
|
Inspecting Figure 7 we can observe that the horizon cuts the
illumination hemisphere into an open part and into an occluded part. Both parts
are spherical segments. The central angle of the open segment
is defined by the tangent plane of the mesostructure surface and
the macrostructure surface, which equals to
.
Thus the ambient occlusion is
Let us consider the top of the displacement map where the horizon is the mean macrostructure surface.
The angle between macrostructure surface normal
and
current normal
is denoted by
. Using the previous result the ambient occlusion at the top
of the displacement map is
In order to examine the ambient
occlusion at the bottom of the wedge, we assume that the wedge is
symmetric, and we use cone stepping[Policarpo and Oliveira 2007,Szirmay-Kalos and Umenhoffer 2008] to speed up displacement mapping. The angle of the cone
is
a good approximation for the size of the open spherical segment.
The ambient occlusion for this case is:
The result of the application of this formula is shown by Figure 8
Rendering requires the computation of direct lighting and indirect lighting. Indirect lighting is the total contribution of complete light paths of length at least two, including the light source to mean surface transfer, the mean surface to mean surface transfer, the mean surface to detailed surface transfer, and finally the detailed surface to eye transfer. To obtain direct lighting variance shadow mapping is implemented [Donnelly and Lauritzen 2006]. The shadow map is also used to determine the visibility of the entry points.
Indirect lighting is an integral in path space containing paths of lengths at least 2. This integral is factorized into three integrals.
The first integral represents the irradiance
at the entry point caused by a
light source of area
. This integral represents the light source to mean surface transfer,
and can be obtained in the following form:
The second factorized integral is responsible for transferring the irradiance of the entry point
to all those points of the scene that correspond to texel centers.
Recall that
is the texture of irradiance values
caused by setting unit irradiance at entry point
.
These texture values
should be weighted by the real irradiance of the respective entry point, and
the weighted textures should be added.
The total contribution of every entry point to the irradiance at exit point
is
Finally, the irradiance at the exit point is transferred to the eye, taking into account the detailed surface properties. When the scene is rendered from the camera, the direct illumination is evaluated. Simultaneously three textures are fetched, the irradiance texture, the obscurances texture of the medium-scale transfer, and the ambient occlusion texture associated with the displacement map. The ambient occlusion texture has much higher resolution and might also be a periodic texture. To include the mean surface to local surface transfer, the three texture values are multiplied. This transfer represents the indirect illumination where the length of the last ray is smaller than the threshold between medium-scale and large-scale transfers. To also include indirect illumination of paths of length 2, where the last ray belongs to the medium-scale category, the obscurances value are multiplied by the direct illumination. Finally, the direct illumination and indirect illumination terms are added (Figure 9).
Dynamic objects should be rendered by on-the-fly techniques. To take into account the indirect illumination of the static environment on dynamic objects, we used localized cube map based approaches proposed in [Szirmay-Kalos et al. 2005,Szirmay-Kalos and Lazányi 2006].
![]() |
![]() |
|
The discussed method has been implemented and integrated into the Ogre3D game engine, and used in various demo games. Figure 10 demonstrates the power of medium-scale pre-computed transfer. When rendering this scene we set the threshold to be equal to the size of the scene, i.e. all indirect transfers were handled only by the obscurances approach. Figures 11 and 12 show the Space Station game. Here we used the same threshold as when rendering Figure 5. Figure 12 also compares the proposed real-time global illumination method with classical local illumination rendering. Figure 13 shows close ups and an overview of the Moria game. All these games run at 30 FPS on NV7900 GPUs.
|
|
|
|
|
|
This paper proposed a factoring method to present global illumination renderings in games and real-time systems. The basic idea is to decompose lighting phenomena according to their spatial and temporal frequency characteristics, and pre-compute low-frequency components. This way, global illumination effects can be presented in real-time systems, although approximately but with no disturbing visual artifacts.
This work has been supported by the National Office for Research and Technology and by OTKA K-719922 (Hungary), and by the GameTools FP6 (IST-2-004363) project.