Caustics Mapping: An Image-Space Technique For Real-Time Caustics
Caustics Mapping: An Image-Space Technique For Real-Time Caustics
net/publication/6582416
CITATIONS READS
75 1,962
3 authors, including:
All content following this page was uploaded by Musawir Shah on 18 December 2014.
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
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
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.
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)
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.
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.