0% found this document useful (0 votes)
85 views

Caustics Mapping: An Image-Space Technique For Real-Time Caustics

This document summarizes a 2007 paper that presents a real-time image-space technique called "caustics mapping" for rendering caustics from reflective and refractive objects in computer graphics. The algorithm avoids expensive geometric tests and pre-computation by creating a caustic map texture and using it to render caustics onto surfaces in real-time on graphics hardware, achieving results comparable to offline rendering. It supports fully dynamic geometry, lighting and viewing without restrictions on other effects like shadows.

Uploaded by

KirbyCrono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
85 views

Caustics Mapping: An Image-Space Technique For Real-Time Caustics

This document summarizes a 2007 paper that presents a real-time image-space technique called "caustics mapping" for rendering caustics from reflective and refractive objects in computer graphics. The algorithm avoids expensive geometric tests and pre-computation by creating a caustic map texture and using it to render caustics onto surfaces in real-time on graphics hardware, achieving results comparable to offline rendering. It supports fully dynamic geometry, lighting and viewing without restrictions on other effects like shadows.

Uploaded by

KirbyCrono
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/6582416

Caustics Mapping: An Image-Space Technique for Real-Time Caustics

Article  in  IEEE Transactions on Visualization and Computer Graphics · March 2007


DOI: 10.1109/TVCG.2007.32 · Source: PubMed

CITATIONS READS
75 1,962

3 authors, including:

Musawir Shah Sumanta Pattanaik


University of Central Florida University of Central Florida
5 PUBLICATIONS   118 CITATIONS    125 PUBLICATIONS   5,454 CITATIONS   

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Musawir Shah on 18 December 2014.

The user has requested enhancement of the downloaded file.


IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 1

Caustics Mapping: An Image-space Technique for


Real-time Caustics
Musawir Shah, Jaakko Konttinen, Sumanta Pattanaik

Abstract— In this paper, we present a simple and prac-


tical technique for real-time rendering of caustics from
reflective and refractive objects. Our algorithm, concep-
tually similar to shadow mapping, consists of two main
parts: creation of a caustic map texture, and utilization
of the map to render caustics onto non-shiny surfaces.
Our approach avoids performing any expensive geometric
tests, such as ray-object intersection, and involves no
pre-computation; both of which are common features
in previous work. The algorithm is well suited for the
standard rasterization pipeline and runs entirely on the
graphics hardware.

I. I NTRODUCTION
AUSTICS are complex patterns of shimmering
C light that can be seen on surfaces in presence
of reflective or refractive objects, for example those
formed on the floor of a swimming pool in sunlight.
Caustics occur when light rays from a source, such as
the sun, get refracted, or reflected, and converge at a
single point on a non-shiny surface. This creates the Fig. 1. Image rendered using the caustics mapping algorithm. This
result was obtained using double surface refraction (both for the
non-uniform distribution of bright and dark areas. Figure appearance of the bunny as well as for the caustics) at the rate of
2 shows a photograph of caustics from a glass sphere 42 fps.
captured with a digital camera. Caustics are a highly
desirable physical phenomenon in computer graphics due
to their immersive visual appeal. Some very attractive
results have been produced using off-line high quality computation performed on the CPU. This is an important
rendering systems; however, real-time caustics remain criterion in certain applications, such as games, in which
open to more practical solutions. Deviating from the the CPU is already extensively scheduled for various
conventional geometry-space paradigm, which involves tasks other than graphics.
path tracing in a 3D scene, intersection testing, etc, we The remainder of this paper is organized as follows:
explore an image-space approach to real-time rendering a short survey of related work is presented in Section 2.
of caustics. Our algorithm has the simplistic nature Our rendering algorithm is then explained in Section 3,
of shadow mapping, yet produces impressive results followed by Section 4 discussing results and limitations.
comparable to those created using off-line rendering. We We conclude with a summary of the ideas presented in
support fully dynamic geometry, lighting, and viewing the paper and provide directions for future research in
direction since there is no pre-computation involved. Section 5.
Furthermore, our technique does not pose any restrictions
on rendering of other phenomena, such as shadows, II. P REVIOUS W ORK
which is the case in some previous work [3]. Our Although caustics rendering, in general, has been
algorithm runs entirely on the graphics hardware with no subjected to a fair amount of research, a practical real-
{mali,jaakko,sumant}@cs.ucf.edu, School of Computer Science, time caustics rendering does not exist for everyday
University of Central Florida applications. In this section, we look at some of the
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 2

the algorithm since the amount of computation done is


directly proportional to the number of sample points used
in rendering caustics.
Perhaps the most prominent caustics are those formed
in the presence of water. Therefore, the problem of
rendering underwater caustics specifically has received
significant attention. In early work, Stam [13] pre-
computed underwater caustics textures and mapped them
onto objects in the scene. Although this technique is
extremely fast, the caustics produced are not correct
given the shape of the water surface and the receiver
geometry. Trendall and Stewart [15] have shown re-
Fig. 2. Photograph of caustics from a spherical glass paper weight fractive caustics to demonstrate the use of graphics
using a desk lamp to emulate directional spotlighting. The caustics
are formed on rough paper placed underneath the refractive object.
hardware for performing general purpose computations.
Their intent was to perform numerical integration which
they used to calculate caustic intensities on a flat receiver
surface. Their method cannot support arbitrary receiver
earlier work in offline caustics rendering and recent geometry and also cannot be easily extended to handle
attempts to achieve caustics at interactive frame-rates. shadows.
For a fair amount of computational cost, accurate and Beam tracing has been employed to produce more
extremely beautiful caustics can be produced. Introduc- physically accurate underwater optical effects, caustics
tory work using backward ray-tracing was proposed by in particular [5], [17]. In this technique, a light beam
Arvo [1], which was then pursued and extended by a through a polygon of the water surface mesh is traced
number of researchers. In this method, light rays are to the surface of a receiver object, hence projecting the
traced from the light source into the scene as opposed to polygon onto the receiver. The energy incident on the
conventional ray tracing in which the rays emerge from water surface polygon is used to compute the caustic
the eye. Photon mapping, a more flexible framework, was intensity at the receiver, taking into account the areas
proposed by Jensen [9] which handles caustics in a nat- of the surface and projected polygons. The intensity
ural manner on arbitrary geometry and can also support contributions from all the participating polygons are
volumetric caustics in participating media [10]. Variants accumulated for the final rendering.
and optimized versions of path tracing algorithms have Nishita and Nakamae [11] present a model based on
been presented which utilize CPU clusters [4] and graph- beam-tracing for rendering underwater caustics including
ics hardware [12]; but the computational cost in time volumetric caustics. Their idea was implemented on
and resources are limiting factors in practical application graphics hardware by Iwasaki et al. [7]. In a more recent
of these techniques to real-time systems. Wyman et al. publication Iwasaki et al. [8] adopt a volume rendering
[19] rendered caustics at interactive frame-rates using a technique in which a volume texture is constructed
large shared-memory machine by pre-computing local for receiver objects using a number of image slices
irradiance in a scene and then sampling caustic infor- containing the projected caustic beams. The case of
mation to render nearby surfaces. Such pre-computation warped volumes which can occur in beam tracing has
steps in algorithms restrict their functionality to domains not been addressed in either of the above. Ernst et al.
for which the pre-computation was performed and are [3] manage this scenario and also present a caustic in-
unable to support fully dynamic scenes. Our algorithm tensity interpolation scheme to reduce aliasing resulting
is also based on the backward ray-tracing idea, however in smoother caustics. However, their algorithm is unable
it does not require any pre-computation. to obtain shadows since it does not account for visibility.
Wand and Straβ er [16] developed an interactive caus- In contrast, our algorithm is able to handle shadows and
tics rendering technique by explicitly sampling points in general does not impose any restrictions on rendering
on the caustics-forming object. The receiver geometry is other phenomena.
rendered by considering the caustic intensity contribution Independently and in parallel with our work, Szirmay-
from each of the sample points. The authors presented Kalos et al. [14] conducted research on approximating
results using specular caustics-forming objects, but re- ray-geometry intersection estimation using distant im-
fractive caustics can also be achieved with this technique. posters which they applied to rendering caustics. Al-
However, the explicit sampling hinders the scalability of though this technique is similar to ours, there are two
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 3

main differences. We present an intersection estimation


algorithm which maps to the Newton-Raphson root find-
ing method that has faster convergence than the Secant surface normals
method used by Szirmay-Kalos et al. [14]. Furthermore,
light rays
a ray-plane intersection operation is performed for every refractive object
iteration of their method which is not needed in our
algorithm.

III. R ENDERING C AUSTICS refracted


racted rays
Our rendering algorithm consists of two main phases:
(i) construction of a caustic map texture, and (ii) ap-
plication of the caustics map to diffuse surfaces called
receivers. We will first give a brief explanation of how diffuse "receiver" object
caustics are formed, and then relate it to our method of
construction of the caustic-map. Fig. 3. Diagram showing how multiple light rays can refract
through an object and converge at the same point on a diffuse surface.

A. Caustic formation
Caustics are formed when multiple rays of light con-
verge at a single point. This occurs in the presence texture from the light’s view. 3D world coordinates
of refractive or reflective objects which cause the light are output for each pixel instead of color. This posi-
rays to deviate from their initial path of propagation tions texture is used for ray-intersection estimation
and converge at a common region. Therefore, to ob- in the next step.
tain caustics accurately, one must trace light rays from • Obtain 3D positions and surface normals of the

their source and follow their paths through refractive refractive object: The refractive object is rendered
and off reflective surfaces. The photons eventually get to texture from the light’s view. Using multiple
deposited on nearby diffuse surfaces, called receivers, render targets, the surface normals and 3D world
thus forming caustics as illustrated in Figure 3. Our coordinates are output for each pixel. These textures
algorithm closely emulates this physical behavior, and are used with a grid of vertices of equal resolution,
is capable of obtaining both refractive and reflective such that each vertex maps to a pixel on the texture.
caustics. For reflective caustics we support a single The vertex grid is used for the remainder of the
specular bounce. In the case of refractive caustics, in algorithm in place of the refractive object.
addition to single surface refraction, our method also • Create caustic-map texture: The caustic-map tex-

supports double surface refraction employing the image- ture is created by splatting points onto the receiver
space technique recently proposed by Wyman [18]. The geometry from each vertex of the refractive vertex
algorithm supports point and directional lighting. Area grid along the refracted light direction. The inter-
lights can be accommodated by sampling a number of section point of the refracted ray and the receiver
point lights. geometry is estimated using the positions texture.
This step is explained in detail in the following
section.
B. Caustics Mapping Algorithm • Construct shadow map: Although optional, con-
Without loss of generality, we will describe render- ventional shadow mapping can easily be integrated
ing of caustics through refractive objects using our into the caustics mapping algorithm to render im-
algorithm. A general overview of the algorithm, which ages with both caustics and shadows.
closely resembles shadow mapping, is presented next • Render final scene with caustics: The 3D scene
along with elaborative discussion on certain parts. is rendered to the frame buffer from the camera’s
Following is a stepwise breakdown of the main caus- view. Each point of the receiver surface is projected
tics mapping algorithm. Since the algorithm runs entirely into the light’s view to compute texture coordinates
on the GPU, it is explained in terms of render passes for indexing the caustic-map texture. The caustic
performed on the graphics hardware. color from the texture is assigned to the pixel and
• Obtain 3D positions of the receiver geometry: augmented with diffuse shading and shadowing.
The receiver geometry is rendered to a positions The steps mentioned above are performed every frame
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 4

in separate render passes, and thus impose no constraints


on the dynamics of the scene. Furthermore, no compu- normal
tation is performed on the CPU; neither as a per-frame
operation nor as a pre-computation. v
r
C. Creating the Caustic-Map d' P1
Rendering of the caustics map texture lies at the heart
of our algorithm. It consists of three main steps:
• Refraction of light at each vertex of the refracting
P1 projection P2 final estimate
surface
• Estimation of the intersection point of the refracted
ray with the receiver geometry
Fig. 4. Diagram of the intersection estimation algorithm. The
• Estimation of caustic intensity at the intersection solid-lined arrows correspond to the position texture lookups.
point
The caustic-map texture is created by rendering the
refractive vertex grid from the light’s view. The vertices
are displaced along the refracted light direction by the where d is the distance from the vertex v. Estimating
estimated distance and then splatted onto the receiver the point of intersection amounts to estimating the value
geometry by rendering point primitives instead of trian- of d, the distance between v and the receiver geometry
gles. The algorithm is implemented in a vertex shader along −→r . An initial value of 1 is assigned to d and a
program and proceeds as follows: new position, P1 , is computed:

for each vertex v do



− P1 = v + 1 ∗ −

r (2)
r = Refract( LightDirectionVector )
P = EstimateIntersection( v.position, −

r,
P1 is then projected into the light’s view space and
ReceiverGeometry )
used to look up the positions texture. The distance, d’,
v.position = P
between v and the looked up position is used as an
return v
estimate value for d in Equation 1 to obtain a new point,
Notice that multiple vertices can end up at the same P2 . Finally, P2 is projected in to the light’s view space
position on the receiver geometry. In the pixel shader, the and the positions texture is looked up once more to
light intensity contribution from each vertex is accumu- obtain the estimated intersection point. Following is a
lated using additive alpha blending. Details regarding the snippet of shader language code that computes the esti-
intensity and final caustic color computation are given in mated intersection point. The inputs to this algorithm are
Sub-section III D. the initial point on the ray, v, the normalized refraction
The intersection point of the refracted ray with the direction vector, −→
r , and a texture sampler, posTexture,
receiver geometry must be computed in order to output used to lookup the positions texture.
the final position of the vertex being processed. Nor-
float3 EstimateIntersection ( float3 v, float3 r,
mally, this requires expensive ray-geometry intersection
sampler posTexture ) {
testing which is not feasible for real-time applications.
We present a novel image-space algorithm for estimating float3 P1 = v + 1.0*r ;
the intersection point which, to our knowledge, has not float4 texPt = mul( float4( P1, 1 ) , mViewProj );
been used before. float2 tc = float2(0.5*(texPt.xy/texPt.w)+float2(0.5,0.5));
The intersection estimation algorithm utilizes the po- tc.y = 1.0f - tc.y;
sitions texture rendered in the first pass of the main float4 recPos = tex2D(posTexture, tc);
caustics mapping algorithm. A schematic illustration of float4 P2 = v +distance(v,recPos.xyz)*r;
the procedure is shown in Figure 4. Let v be the position texPt = mul( float4( P2, 1 ) , mViewProj );
of the current vertex and − →r the normalized refracted tc = float2(0.5*(texPt.xy/texPt.w)+float2(0.5,0.5));
light vector. Points along the refracted ray are thus tc.y = 1.0f - tc.y;
defined as: return recPos = tex2D(posTexture, tc);
}
P =v+d∗−

r (1)
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 5

Proof: We will construct a proof by applying the defin-


ition of fˆ. Let d be the distance along the refracted ray from
the ray origin to the intersection point. Let p = v + d ∗ − →r,


where v is the ray origin and r is the ray direction. If the
positions texture is looked up by projecting p into the light’s
view, the same point p is obtained. Since the distance of a
point from itself is 0, the value of fˆ must be equal to 0 by
definition.

Thus the intersection estimation problem has been reduced


Fig. 5. Caustics on non-planar surfaces can be obtained using to the problem of computing the root of fˆ. Although any root
Caustics Mapping. The scene shows underwater caustics on a shark finding algorithm can be applied as per user preference, the
and a rugged seabed.
Caustics Mapping algorithm uses an iterative method derived
from the Newton-Raphson (NR) algorithm. The NR iteration
is defined as follows:
D. Convergence of Intersection Estimation Algorithm
The intersection estimation algorithm is essentially an iter- To find a root of fˆ(d) = 0 with the initial guess d0 ,
ative process of which a single iteration has been discussed
fˆ(dk )
above. For example, in the next iteration the distance between dk+1 = dk − where k = 0, 1, 2, 3, ... (4)
the estimated intersection point in the last iteration and v would fˆ0 (dk )
be plugged into Equation 1 as a new estimate value for d. This Note that the NR iteration requires the evaluation of the
iterative process was derived from the Newton-Raphson root derivative function, fˆ’(d). Since the function fˆ is in a discrete
finding method, whose convergence rate is faster than other form, its derivative can be computed using finite differences.
popular methods such as the Secant and Bisection methods. In
this sub-section, we map the problem of intersection estimation fˆ0 (d) = (fˆ(d + ∆) − fˆ(d))/∆ (5)
to a root finding problem. We then discuss the Newton-
Raphson method and relate it to our intersection estimation GPU code for the NR iteration is provided in the Appendix,
algorithm. and it can be used in place of our approximative iterative
solution if desired with the added cost of computing the
In order to compute the intersection using a root finding
derivative. In certain cases where the derivative is approxi-
method, we must define a function, f(x), whose zero corre-
mated using the difference between two points specifying an
sponds to the point of intersection of the refracted ray and the
interval, this iteration is referred to as the Secant method. Note
receiver geometry. Let the refracted ray be the x-axis for a
that the Secant method operates on an interval of arbitrary
discrete function, f(x). f(x) is the distance between x and the
length, whereas to compute the derivative of a function using
projection of x. For each point, xi , along the refracted ray
finite difference in the NR method, the interval has to be
at a distance di from the origin of the ray, f(x) is defined as
small. Computing the derivative requires two evaluations of
follows:
the function fˆ. This directly translates to two accesses of the
yi = posT exture(xi ) positions texture per iteration. In order to reduce the overall
(3) number of texture accesses, we introduce an approximation
f (xi ) = distance(xi , yi )
to the NR evaluation. The NR method gives dk+1 , the new
The function posTexture(xi ) retrieves a 3D point from the estimate of the root point by incrementing dk , with a scaled
positions texture by projecting xi into the light’s view and version of fˆ(dk ), the function value at dk . The exact scale is
computing texture coordinates. For example, in Figure 4, the the negative reciprocal of the derivative of the function at dk .
distance between P1 and P1 projection is the value for f(P1 ). In our method we use the distance of the surface geometry
For simplicity, f(x) can be re-parameterized using the dis- at dk from the origin of the refracted ray (i.e. d0 =0) as the
tance, d, from the origin of the ray instead of a 3D point, x, estimate for dk+1 . This approximation of the NR iteration was
along the ray: f(v + d * −

r ) or simply, fˆ(d) (recall that v and −

r influenced by three key observations:
are the origin and the direction of the refracted ray). Notice • A rough similarity to NR estimator: The distance of the
that when d is equal to the distance from the refracted ray surface geometry at dk from the origin of the refracted
origin to the intersection point, fˆ(d) is equal to 0. Therefore, ray (i.e. d0 =0), can be approximated as dk incremented
the root of fˆ(d) directly corresponds to the distance to the by an amount related to fˆ(dk ).
intersection point. We can now define the following theorem: • Correctness: At the root, i.e. at the point of intersection,
dk is indeed equal to the distance of the surface geometry
from the origin of the ray.
Theorem 1: fˆ(d) = 0 if and only if d is equal to the distance • Computational efficiency: This estimator eliminates the
along the refracted ray from the ray origin to the intersection need for explicitly computing the function derivative and
point. thus cuts down the number of texture lookups by half.
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 6

Fig. 6. Caustics from a glass sphere (from left to right) using the distance imposters method, our caustics mapping, and photon mapping.
3 iterations of the respective intersection estimation algorithms were used for both the first and the second image. The distance imposter’s
method produced a frame rate of 160 fps whereas caustics mapping produced 245 fps on a GeForce 7800.

to the Newton-Raphson method is that in some cases it


starts oscillating between two reference points and thus never
converges to the true root. This problem is attributed to the fact
that the Newton-Raphson method keeps only the most recent
estimated point instead of an interval which contains the root
point. This oscillation, however, can be detected by storing the
last two estimates and then remedied by switching to a more
conservative algorithm such as the Bisection method.
We have found empirically that the estimate of the intersec-
Fig. 7. Difference images of (Left) the distance imposters method,
tion point improves rapidly with each iteration. The magnitude
and (Right) our caustics mapping method with photon mapping. The
difference images were obtained from the results shown in Figure 6. of the error and the number of iterations to convergence
depends on the topology distribution of the scene. For a fairly
uniform topology, the error is negligible after only 5 iterations.
For the purpose of rendering caustics, we observed that only
The intersection estimation algorithm assumes that the true a single iteration is sufficient. Furthermore, the small error
intersection point lies at the same distance from v as the in the estimation is well sustained by our caustics mapping
current estimate point. Visually, this can be observed as a algorithm and thus is suitable for the purpose. It is important
circular arc connecting P1 and P2 , centered at v with radius d’. to note that the algorithm is not limited to rendering caustics
The assumption that the receiver surface is curved rather than on planar surfaces. As long as the visibility function is well
planar in the local region of the intersection was motivated by defined and continuous, even fairly rugged terrains produce
the fact that no explicit intersection tests would be required in accurate results. Figure 5 shows under-water caustics falling
the former case. The algorithm thus incurs the cost of just a on a shark and the floor, both of which have non-planar surface
texture look-up at each iteration, unlike the distant imposters geometry.
technique which additionally requires a ray-plane intersection
test.
As with all iterative root finding methods, the continuity E. Caustic Intensities
of the function is a vital criterion for convergence. Thus in The intensity of the caustics formed on the diffuse receiver
order for the intersection estimation to be successful, the geometry depends on the amount of light that gets accumulated
visibility of the receiver geometry from the light’s view must at any particular point on the receiver’s surface. Since the
be well defined. Note that when the positions texture lookup caustics map texture is created by refracting or reflecting
returns a null value, it implies that no receiver geometry was the light rays at each vertex, the intensity of the caustics
seen in that direction. If this null value is encountered in will depend on the number of vertices which make up the
the intersection estimation algorithm, the result obtained is caustic-forming object. If the algorithm is employed using a
incorrect. In practice, the value returned is a point at infinity. naive accumulation scheme, the caustics will appear to be
Such a situation arises near the edges of the reciever geometry. bright or dark depending on the number of vertices of the
However, this only means that some of the caustic splats refractive object. This undesirable phenomenon occurs due to
would be lost, but it does not cause any visual artifacts in the incorrect assumption that the light flux contribution for
the final caustics rendering. Another limitation that is specific each vertex is the same. We combat this problem by computing
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 7

Fig. 8. Frames from a water animation demo with caustics mapping. Random ”plops” are introduced in the water surface mesh at regular
time intervals. Notice the caustics pattern and the corresponding shape of the water surface.

a weighting coefficient for each vertex which is then multiplied For single refractive surfaces such as water, attenuation is
with the incident light. performed over the distance between the surface and the
In order to compute the coefficient for a vertex, the total flux receiver geometry.
contribution for that vertex must be determined by observing
the total flux through the surface of the caustic-forming object F. Implementation Issues
visible to the light souce. Therefore, the total flux contribution
for each vertex in the grid is computed as: The caustics mapping algorithm suffers from issues similar
to shadow mapping and other image-space techniques. There
1 are two main points of concern that must be addressed:
Φi = (Ni · Li ) (6) aliasing, and view frustum limitation. The former issue is
V
inherent in all image-space algorithms. This problem is further
where V is the total projected visible surface area of the object,
magnified due to the usage of point primitives rather than
Ni is the surface normal vector at the vertex, and Li is the
triangles for rendering of the caustic-map. The gaps between
incident light vector. V is determined by counting the number
the point splats give a non-continous appearance to the caus-
of vertices of the refractive grid that are occupied by the
tics. However, if there are sufficient number of vertices in
projection of the refractive object. Since the grid resolution
the refractive vertex grid, the gaps are significantly reduced.
is the same as that of the render target texture(s) used in
Figure 11 shows a comparison of the caustics produced with
Step 2 of the Caustics Mapping algorithm, the number of
two different refractive grid resolutions: 64×64 and 128×128.
rasterized pixels in that step gives the value for V. The process
In our implementations, we have used grids of 128 × 128
of determining the number of rasterized pixels is known as
vertices. It is important to note that the tessellation of the
occlusion querying, and this feature is generally implemented
mesh of refractive object has no effect on the quality of the
in modern graphics APIs. The occlusion query simply returns
caustics, which is solely dependent on the resolution of the
the number of pixels that pass the Z-test.
refractive grid. Further antialiasing can be achieved by using
It is important to note that the caustic intensity computation
textured point primitives with a gaussian fall-off for splatting.
is performed every frame since the projected visible surface
area can change. However, it does not involve any complex
operations that can have a significant impact on the frame-rate.
The final color of the caustics formed through a refractive
object is computed by taking into account the absorption
coefficient of the object’s material. This enables us to achieve
colored caustics as shown in Figure 1 and Figure 13.

I = Io e−Ka d (7)

where Io is the incident light intensity, Ka is the absorption


coefficient, and d is the distance that light travels through
the refractive object. This distance is easily determined by
rasterizing the back-faces of the object in an initial render Fig. 9. Caustics rendered using our algorithm for simple objects
pass to obtain positions of the hind points. In fact, this data such us spheres (245fps) as well as complex ones such as the Stanford
is already available if double surface refraction is used [18]. bunny (200fps)
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 8

seen in Figure 8. It was rendered at a resolution of 640 × 480


at the rate of 60 frames per second. The mesh used for the
water surface consisted of 100 × 100 vertices.

Fig. 10. Comparison of photon mapping (Left) and Caustics


Mapping (Right) for a complex refractive object.

This produces continuity between the individual point splats,


and was employed for generating all the images in this paper.
Although not required, the caustic-map texture can also be
low-pass filtered for additional smoothening of the caustics.
The second issue pertaining to the algorithm is the view
frustum limitation during rasterization of the caustic-map. This
problem is exactly like that of shadow mapping with point Fig. 11. Effect of refractive grid resolution. The top image was
lights. In such a case an environment shadow map is created, rendered using a grid resolution of 64×64, whereas the bottom
usually with six 2D textures corresponding to each face of a image was rendered using a grid resolution of 128×128. The gaps
cube map rather than a single texture. Similarly, in the caustics between point splats that are visible at grid resolution 64x64, are
mapping algorithm if the caustics are formed outside the not noticeable at grid resolution 128x128
light’s view frustum, they will not be captured on the caustic-
map texture. This happens more frequently with reflective
caustics than refractive ones. Using an environment caustic For solid refractive objects, using double-surface refraction
map solves this problem at an overhead cost of rendering is more physically correct. Most of the previous work done
extra textures. In our implementation we employed cube maps, in real-time caustics rendering is limited to single-surface
however the dual paraboloid mapping technique proposed by refraction and cannot be easily extended to include the double-
Heidrich [6], which has been applied to shadow mapping for surface interaction. Our algorithm effortlessly accommodates
omnidirectional light sources by Brabec et al. [2], can also be Wyman’s [18] image-space double-surface refraction. We ren-
utilized. dered various simple and complex objects and observed the
caustics that they produced. The results with caustics from
a sphere, and the Stanford bunny are shown in Figure 9.
IV. R ESULTS AND L IMITATIONS Notice that the frame-rate even with double-surface refraction
The caustics mapping algorithm was developed and imple- is quite high. The shadows in these images were obtained using
mented on a 2.4GHz Intel Xeon PC with 512MB of physical conventional shadow mapping. Since we deal with point lights,
memory. However, since the algorithm performs no compu- a shadow cube map was employed. The resolution of both the
tation on the CPU, a lower-end processor will be sufficient. shadow map and the caustics map was 768×768×6 pixels for
We employed a GeForce 7800 graphics card and pixel shader rendering final images of resolution 1024 × 768 pixels. Figure
model 3.0 because the algorithm requires texture access in 1 shows caustics from the Stanford bunny up close, occupying
the vertex shader for intersection estimation in the caustic- most of the caustic map region. The frame-rate in this case is
map generation step. The algorithm was implemented using 42fps, which shows that the algorithm is fill-rate dependent.
Microsoft DirectX 9.0 SDK. Figure 10 shows a comparison of images rendered with
The major advantage of our algorithm is the speed at which Caustics Mapping and an offline rendering system using
it renders the caustics, making it very practical for utilization photon mapping. Notice that even with complex objects,
in games and other real-time applications. We conducted a such as the Stanford bunny, our algorithm produces visually
number of tests and produced results to demonstrate the convincing results. Some small differences do exist, and they
feature-set of our algorithm. Caustics from both refractive are mainly attributed to the accuracy of the emulation of the
and reflective objects were generated. For refractive objects, refraction events that take place as light travels through the
two main categories were established: single-surface refrac- bunny to the receiver surface. For simpler geometry, such as
tion, and double-surface refraction. Single-surface refraction spheres, the caustics produced using our algorithm are closer
is suitable for underwater caustics since there is only a single to those produced with photon mapping since the refraction
refraction event as light enters through the water surface and events are fairly simple and can be accurately emulated using
hits the floor. The result of our underwater caustics can be double surface refraction. Figure 6 shows a comparison of
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 9

the distant imposters method, our caustics mapping algorithm, Finally we would like to develop methods of applying the
and photon mapping using PBRT. The difference images are caustics mapping algorithm to participating media and achieve
shown in Figure 7. The difference image on the right shows volumetric caustics.
that the caustics generated by our method are similar to the
caustics generated from classical photon mapping algorithm.
Caustics from reflective objects using our method are shown ACKNOWLEDGMENT
in Figure 12. Our caustics mapping algorithm performs better
with refractive caustics than reflective ones since the error in The authors would like to thank Guillaume Francois, Kévin
the intersection estimation during the caustic-map generation Boulanger, and Jared Johnson for their insightful comments,
step tends to be greater in the latter case. This is due to the fact and Eric Risser for assistance with illustrations used in this
that refraction causes small deviations in the path of the light paper. This work was supported in part by I2Lab, Electronic
ray, whereas reflection causes the ray to change its direction Arts and ATI Reseach.
completely. Therefore for the reflection case, the visibility
function is more probable to be discontinuous. We would like
to improve upon our intersection estimation algorithm in future A PPENDIX
work to better handle this issue.
Another limitation of our algorithm is that it does not easily The following code listing is a GPU implementation of
extend to volumetric caustics like some techniques proposed the Newton-Raphson root finding method for the intersection
in previous work [3]. This is mainly due to the fact that the estimation computation. Note that this is the original, un-
caustic-mapping algorithm operates in image-space. One way modified version of the Newton-Raphson algorithm. In our
of achieving volumetric caustics using our algorithm is to work, we use a modified version which does not require
use a number of planes perpendicular to the light ray as the the computation of the derivative and is thus cheaper to
caustic receivers. However this method spawns further issues evaluate. The input parameters to the function are respectively:
relating to sampling and volumetric rendering which need to pos, the origin of the refracted ray; dir, the direction of the
be addressed. refracted ray; mVP, the light’s View-Projection matrix; posTex,
the receiver geometry positions texture; num iter, the desired
number of iterations. The function getTC() used in the code
computes texture coordinates from a 3D point by projecting
it to the texture’s view plane and moving it to the range
[0,1], identical to computing shadow mapping coordinates.
The function returns the distance along the refracted ray as
an estimate of the intersection point.

float rayGeoNP(float3 pos, float3 dir, float4x4 mVP,


sampler posTex, int num_iter)
{
float eps = 0.1;
float2 tc = float2(0.0,0.0);

Fig. 12. Reflective caustics from a metal ring. The desired shape // initial guess
that is observed in real life is obtained from the caustics-mapping float x_k = 0.10;
algorithm. Notice the circular caustic band outside the left edge of for(int i=0;i<num_iter;i++)
{
the ring.
// f(x_k)
float3 pos_p = pos + dir*x_k;
tc = getTC(mVP, pos_p);
float3 newPos1 = tex2D(posTex, tc);
float f_x_k = distance(newPos1 , pos_p);
V. C ONCLUSION AND F UTURE W ORK
// f(x_k + eps)
We have presented a practical real-time caustics rendering float3 pos_q = pos + dir*(x_k+eps);
algorithm that runs entirely on the graphics hardware and tc = getTC(mVP, pos_q);
float3 newPos2 = tex2D(posTex, tc);
requires no pre-computation. It emulates the light transport float f_x_k_eps = distance(newPos2 , pos_q);
involved in caustics formation in the image-space; therefore
it is both physically inspired and fast. The algorithm is float deriv = (f_x_k_eps - f_x_k)/eps;
conceptually similar to shadow mapping and integrates easily // the newton raphson iteration
into virtually any rendering system. x_k = x_k - (f_x_k/deriv);
We also presented a fast ray-scene intersection estimation }
technique which we plan to further explore and improve in return x_k;
future work. This technique is extremely fast and is well suited }
to algorithms, such as caustics mapping, which can tolerate a
certain amount of error in the estimation.
IEEE TRANSACTIONS ON VISUALIZATION AND COMPUTER GRAPHICS 10

Fig. 13. (Left) Colored caustics from a refractive bunny with light attenuation in different color channels. (Right) Spectral refraction effect
obtained using the caustic mapping algorithm with different refractive indices for each of the three RGB color channels.

R EFERENCES ceedings: The art and interdisciplinary programs of SIGGRAPH


’96, page 150, New York, NY, USA, 1996. ACM Press.
[1] James Arvo. Backward ray tracing. In Developments in Ray [14] László Szirmay-Kalos, Barnabás Aszódi, István Lazányi, and
Tracing, SIGGRAPH ’86 Course Notes, August 1986. Mátyás Premecz. Approximate ray-tracing on the GPU with
[2] Stefan Brabec, Thomas Annen, and Hans-Peter Seidel. Shadow distance impostors. In Proceedings of Eurographics 2005, 2005.
mapping for hemispherical and omnidirectional light sources. [15] C. Trendall and A. Stewart. General calculations using graphics
In Computer Graphics International, 2002. hardware with applications to interactive caustics. In Euro-
graphics Workshop on Rendering, pages 287–298, 2000.
[3] Manfred Ernst, Tomas Akenine-Möller, and Henrik Wann
[16] M. Wand and W. Straßer. Real-time caustics. Computer
Jensen. Interactive rendering of caustics using interpolated
Graphics Forum, 22(3):611–611, 2003.
warped volumes. In Graphics Interface, May 2005.
[17] Mark Watt. Light-water interaction using backward beam
[4] Johannes Günther, Ingo Wald, and Philipp Slusallek. Realtime
tracing. In SIGGRAPH ’90: Proceedings of the 17th annual
caustics using distributed photon mapping. In Eurographics
conference on Computer graphics and interactive techniques,
Symposium on Rendering, pages 111–122, 2004.
pages 377–385, New York, NY, USA, 1990. ACM Press.
[5] Paul S. Heckbert and Pat Hanrahan. Beam tracing polygonal [18] Chris Wyman. An approximate image-space approach for
objects. In SIGGRAPH ’84: Proceedings of the 11th annual interactive refraction. In SIGGRAPH 2005. ACM Press, 2005.
conference on Computer graphics and interactive techniques, [19] Chris Wyman, Charles D. Hansen, and Peter Shirley. Interactive
pages 119–127, New York, NY, USA, 1984. ACM Press. caustics using local precomputed irradiance. In Pacific Confer-
[6] Wolfgang Heidrich. View-independent environment maps. In ence on Computer Graphics and Applications, pages 143–151,
Proceedings of Eurographics/SIGGRAPH Workshop on Graph- 2004.
ics Hardware ’98, 1998.
[7] Kei Iwasaki, Yoshinori Dobashi, and Tomoyuki Nishita. An
efficient method for rendering underwater optical effects using
graphics hardware. Computer Graphics Forum, 21(4):701–711,
2002.
[8] Kei Iwasaki, Yoshinori Dobashi, and Tomoyuki Nishita. A fast
rendering method for refractive and reflective caustics due to
water surfaces. In Eurographics, pages 283–291, 2003.
[9] Henrik Wann Jensen. Global Illumination Using Photon Maps.
In Rendering Techniques ’96 (Proceedings of the Seventh Eu-
rographics Workshop on Rendering), pages 21–30, New York,
NY, 1996. Springer-Verlag/Wien.
[10] Henrik Wann Jensen and Per H. Christensen. Efficient simula-
tion of light transport in scenes with participating media using
photon maps. In Computer Graphics (SIGGRAPH 98), pages
311–320. ACM Press, 1998.
[11] Tomoyuki Nishita and Eihachiro Nakamae. Method of display-
ing optical effects within water using accumulation buffer. In
SIGGRAPH ’94: Proceedings of the 21st annual conference on
Computer graphics and interactive techniques, pages 373–379,
New York, NY, USA, 1994. ACM Press.
[12] Timothy J. Purcell, Craig Donner, Mike Cammarano, Hen-
rik Wann Jensen, and Pat Hanrahan. Photon mapping on
programmable graphics hardware. In Graphics Hardware, pages
41–50. Eurographics Association, 2003.
[13] Jos Stam. Random caustics: natural textures and wave theory
revisited. In SIGGRAPH ’96: ACM SIGGRAPH 96 Visual Pro-

View publication stats

You might also like