Weiskopf 2004
Weiskopf 2004
Abstract
In this paper, we present a mapping of nonlinear ray tracing to the GPU which avoids any data transfer back to
main memory. The rendering process consists of the following parts: ray setup according to the camera param-
eters, ray integration, ray–object intersection, and local illumination. Bent rays are approximated by polygonal
lines that are represented by textures. Ray integration is based on an iterative numerical solution of ordinary dif-
ferential equations whose initial values are determined during ray setup. To improve the rendering performance,
we propose acceleration techniques such as early ray termination and adaptive ray integration. Finally, we dis-
cuss a variety of applications that range from the visualization of dynamical systems to the general relativistic
visualization in astrophysics and the rendering of the continuous refraction in media with varying density.
Categories and Subject Descriptors (according to ACM CCS): I.3.3 [Computer Graphics]: Picture/Image Generation
I.3.7 [Computer Graphics]: Three-Dimensional Graphics and Realism
4.3. Environment Mapping for Asymptotically Flat Sky gauge bosons of the Maxwell field) and therefore has µ = 0.
Similarly, Newton’s law of gravitation also has vanishing µ.
Light rays that leave the scene boundary usually result in
On the other hand, the strong interaction between nucleons
the background color. As an alternative, we use an environ-
(such as protons or neutrons) is mediated by heavy particles,
ment texture that represents light-emitting objects at infinity.
which reduces the range of interaction and is described by a
A cube texture implements such a “sky box”, where the di-
non-vanishing positive value for µ. Adopting a generalized
rection v of a ray at the boundary serves as texture coordi-
radial field, ξ(r) can represent any continuous function. The
nates. This model is valid for scenarios in which the bound-
example in Figure 4 (c) uses
ary geometry already is in (almost) flat regions (where rays
are not or only slightly bent). r3 r2
ξ(r) = 2 3
−3 2 +1 ,
R R
5. Applications for 0 ≤ x ≤ R [Grö95].
(a) (b)
(c) (d)
(e) (f)
Figure 4: Images generated by GPU-based nonlinear ray tracing: (a) undistorted image of the test scene; (b) rays governed
by the Lorenz system, with the same test scene as in (a); (c) rays in a radial potential field; (d) rays in a medium with varying
index of refraction; (e) general relativistic ray tracing with a black hole (Schwarzschild spacetime). Image (f) visualizes an
astrophysical scenario with a neutron star (blue) and a much less heavier, accompanying star (yellow) in front of a background
star field. Checkerboard textures are attached to the two stars to reveal the distortions on the surfaces.
visualization also serves as a tool in teaching physics courses Table 1: Rendering times in seconds on a 800 × 600 view-
and explaining important aspects of relativity to the public, port, with 10 scene objects, 30 ray segments, and 300 inte-
e.g., in popular-science films or exhibitions. gration steps.
could be incorporated to achieve a better scalability with re- An important class of spacetimes is described by the
spect to the number of scene objects. Finally, deferred shad- Schwarzschild metric,
ing could be used to accelerate the illumination computa-
2M dr2
ds2 = 1 − dt 2 − − r2 dθ2 + sin2 θ dφ2 .
tion. By deferring the shading process to the very end of the
r 1 − 2M/r
ray-tracing algorithm, lighting would only be evaluated for
actually hit points. This metric represents a vacuum solution for Einstein’s gen-
eral relativistic field equations and describes the spacetime
around a non-rotating, non-charged, spherically symmetric
Acknowledgments distribution of matter and energy. It applies to many com-
pact astrophysical objects, for example, to regular stars, neu-
We would like to thank the anonymous reviewers for help-
tron stars, or black holes. We choose units in which the
ful remarks to improve the paper. Special thanks to Bettina
speed of light and the gravitational constant are 1. The pa-
Salzer for proof-reading, and to Joachim Vollrath for his help
rameter M denotes the mass of the source of gravitation. In
with the video.
asymptotically flat outer regions of spacetime, the spheri-
cal Schwarzschild coordinates, r, θ, and φ, are identical to
Appendix A: Geodesics in Spacetime the standard spherical coordinates of flat space. In our im-
plementation, the spherical Schwarzschild coordinates are
Here, a brief discussion of the mathematical background of transformed into pseudo-Cartesian Schwarzschild coordi-
general relativity and, in particular, the propagation of light nates. In this way, the x, y, and z components in the ray setup
is given. For a comprehensive presentation we refer to the can be directly used as input to the Schwarzschild metric.
textbooks [MTW73, Wei72]. The concept of curved space- Finally, t denotes time. The temporal component of the po-
time is the geometric basis for general relativity. Spacetime sitions xµ (τ) can be neglected in stationary scenes.
is a pseudo-Riemannian manifold and can be characterized
by the infinitesimal distance ds,
References
3
ds2 = ∑ gµν (x) dxµ dxν , [ASY96] A LLIGOOD K. T., S AUER T. D., YORKE J. A.:
µ,ν=0 Chaos: An Introduction to Dynamical Systems.
Springer, New York, 1996.
where gµν (x) are entries in a 4 × 4 matrix, representing the
metric tensor at the point x in spacetime. The quantities dxµ [BFGS03] B OLZ J., FARMER I., G RINSPUN E.,
describe an infinitesimal distance in the µ direction of the S CHRÖDER P.: Sparse matrix solvers on
coordinate system. Trajectories of freely falling objects are the GPU: Conjugate gradients and multigrid.
identical to geodesics. Geodesics are the generalization of ACM Transactions on Graphics 22, 3 (2003),
the idea of straightest lines to curved manifolds and are solu- 917–924.
tions to the geodesic equations, a set of second-order ODEs: [BTL90] B ERGER M., T ROUT T., L EVIT N.: Ray trac-
d2 xµ (τ) 3
dxν (τ) dxρ (τ) ing mirages. IEEE Computer Graphics and Ap-
dτ2
+ ∑ Γ µ
νρ (x)
dτ dτ
=0 , plications 10, 3 (1990), 36–41.
ν,ρ=0
[CHH02] C ARR N. A., H ALL J. D., H ART J. C.: The
where τ is an affine parameter along the geodesic. The ray engine. In Proceedings of the Eurograph-
Christoffel symbols Γµ νρ are determined by the metric ac- ics/SIGGRAPH Workshop on Graphics Hard-
cording to ware (2002), pp. 37–46.
1 3 ∂gαν (x) ∂gαρ (x) ∂gνρ (x) [CHH03] C ARR N. A., H ALL J. D., H ART J. C.:
Γµ νρ (x) = ∑ gµα (x) + − ,
2 α=0 ∂xρ ∂xν ∂xα GPU algorithms for radiosity and subsur-
face scattering. In Proceedings of the SIG-
where gµα (x) is the inverse of gµα (x). Light rays are a spe- GRAPH/Eurographics Workshop on Graphics
cial class of geodesics: lightlike or null geodesics, which ful- Hardware (2003), pp. 51–59.
fill the null condition,
[Gla93] G LASSNER A. S. (Ed.): An Introduction to
3
dxµ (τ) dxν (τ) Ray Tracing, 4th ed. Academic Press, London,
∑ gµν (x) dτ dτ = 0 . 1993.
µ,ν=0
[GPG04] GPGPU: General-Purpose Computation on
During ray setup, the initial position in spacetime and the
GPUs. Web Page: http://www.gpgpu.org, 2004.
initial spatial direction of the light ray are determined as in
the other models from Section 5. The temporal component [Gro93] G ROSS F.: Relativistic Quantum Mechanics
of the initial direction is then computed according to the null and Field Theory. John Wiley & Sons, New
condition. York, 1993.
[Grö95] G RÖLLER E.: Nonlinear ray tracing: Visualiz- [Wei72] W EINBERG S.: Gravitation and Cosmology:
ing strange worlds. The Visual Computer 11, 5 Principles and Applications of the General The-
(1995), 263–276. ory of Relativity. John Wiley & Sons, New
York, 1972.
[HBSL03] H ARRIS M. J., BAXTER W., S CHEUERMANN
T., L ASTRA A.: Simulation of cloud dy- [Wei00] W EISKOPF D.: Four-dimensional non-linear
namics on graphics hardware. In Proceedings ray tracing as a visualization tool for gravita-
of the SIGGRAPH/Eurographics Workshop on tional physics. In Proceedings of IEEE Visual-
Graphics Hardware (2003), pp. 92–101. ization (2000), pp. 445–448.
[HMG03] H ILLESLAND K. E., M OLINOV S., [YOH00] Y NGVE G. D., O’B RIEN J. F., H ODGINS
G RZESZCZUK R.: Nonlinear optimization J. K.: Animating explosions. In Proceedings of
framework for image-based modeling on SIGGRAPH 2000 Conference (2000), pp. 29–
programmable graphics hardware. ACM Trans- 36.
actions on Graphics 22, 3 (2003), 925–934.
[HW01] H ANSON A. J., W EISKOPF D.: Visualizing rel-
ativity. SIGGRAPH 2001 Course #15 Notes,
2001.
[Kaj86] K AJIYA J. T.: The rendering equation. Com-
puter Graphics (SIGGRAPH ’86 Proceedings)
20, 4 (1986), 143–150.
[KW03] K RÜGER J., W ESTERMANN R.: Linear algebra
operators for GPU implementation of numerical
algorithms. ACM Transactions on Graphics 22,
3 (2003), 908–916.
[KWR02] KOBRAS D., W EISKOPF D., RUDER H.: Gen-
eral relativistic image-based rendering. The Vi-
sual Computer 18, 4 (2002), 250–258.
[Lor63] L ORENZ E. N.: Deterministic nonperiodic
flow. Journal of the Atmospheric Sciences 20
(1963), 130–141.
[MTW73] M ISNER C. W., T HORNE K. S., W HEELER
J. A.: Gravitation. Freeman, New York, 1973.
[Nem93] N EMIROFF R. J.: Visual distortions near a neu-
tron star and black hole. American Journal of
Physics 61, 7 (July 1993), 619–632.
[NRHK89] N OLLERT H.-P., RUDER H., H EROLD H.,
K RAUS U.: The relativistic “looks” of a neutron
star. Astronomy and Astrophysics 208 (1989),
153.
[PBMH02] P URCELL T. J., B UCK I., M ARK W. R., H AN -
RAHAN P.: Ray tracing on programmable
graphics hardware. ACM Transactions on
Graphics 21, 3 (2002), 703–712.
[PDC∗ 03] P URCELL T. J., D ONNER C., C AMMARANO
M., J ENSEN H. W., H ANRAHAN P.: Pho-
ton mapping on programmable graphics
hardware. In Proceedings of the SIG-
GRAPH/Eurographics Workshop on Graphics
Hardware (2003), pp. 41–50.
[Rös76] R ÖSSLER O.: An equation for continuous
chaos. Physics Letters A 57, 5 (1976), 397–398.