How to Format a SCCG Papaer
Total Page:16
File Type:pdf, Size:1020Kb
Chasing the Green Flash: a Global Illumination Solution for Inhomogeneous Media D. Gutierrez F.J. Seron O. Anson A. Muñoz University of Zaragoza University of Zaragoza University of Zaragoza University of Zaragoza [email protected] [email protected] [email protected] [email protected] restrictions on the scenes and effects that can be Abstract reproduced, including some of the phenomena that occur in our atmosphere. Several natural phenomena, such as mirages or the Most of the media are in fact inhomogeneous to one green flash, are owed to inhomogeneous media in degree or another, with properties varying continuously which the index of refraction is not constant. This from point to point. The atmosphere, for instance, is in makes the light rays travel a curved path while going fact inhomogeneous since pressure, temperature and through those media. One way to simulate global other properties do vary from point to point, and illumination in inhomogeneous media is to use a therefore its optic characterization, given by the index curved ray tracing algorithm, but this approach of refraction, is not constant. presents some problems that still need to be solved. A light ray propagating in a straight line would then be This paper introduces a full solution to the global accurate only in two situations: either there is no media illumination problem, based on what we have called through which the light travels (as in outer space, for curved photon mapping, that can be used to simulate instance), or the media are homogeneous. But with several natural atmospheric phenomena. We also inhomogeneous media, new phenomena occur. For present a model of the Human Visual System (HVS) to instance, light in warm air (which has a lower optical display images in a more realistic way, taking into density) moves faster than in cold air, which is denser. account how we perceive luminances in a real-world According to Fermat’s Principle, light crossing a scene. This is of special interest in the green flash medium gets curved towards the areas with the greater effect, where some of the perceived green is owed to index of refraction. This index of refraction, which bleaching of the photoreceptors in the human eye. defines the optical characteristics of the medium, is a function of both humidity and density, as well as Keywords: Rendering, global illumination, photon wavelength, with density being a function of pressure mapping, natural phenomena, inhomogeneous media, and temperature itself. Therefore, in a medium where realism. temperature changes continually, so will the direction of propagation, thus making light rays travel curved paths (with the degree of curvature being a function of 1 Introduction wavelength). Several of the atmospheric effects we see in nature, from mirages to the green flash, are owed to light 2 State of the art traveling curved paths [Minnaert 1993], and therefore are impossible or exceedingly costly to simulate with There are several examples that simulate the behaviour synthetic imagery using standard Monte Carlo ray of light in the atmosphere, such as the works of tracing techniques. Nevertheless, modeling of nature Musgrave [1993] or Nishita [1998]. There is also some has been one of the most ambitious goals of the previous work on curved ray tracing in inhomogeneous Computer Graphics community. media. Berger and Trout [1990] recreate mirages by Most ray tracing algorithms are based on the subdividing the medium into various homogeneous assumption that light rays travel following a straight layers, with a different index of refraction for each one. path. This is so because mentioned algorithms consider Musgrave [1990] proposes a purely reflective model as only homogeneous media, where properties are kept the means of forming mirages, while Groeller [1995] constant. While this assumption works well for a great uses sources of nonlinearity such as gravity centers, number of situations, it nevertheless imposes several gravity lines, chaotic systems and parametric curved rays. Stam and Languenou [1996] propose a solution by obtaining the differential equation that describes the Copyright © 2004 by the Association for Computing Machinery, Inc. trajectory of the ray from the equation of the light Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed wave. Finally, Serón et al. [2002] describe a more for commercial advantage and that copies bear this notice and the full citation on the general method, free of the restrictions that appear in first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on the above papers regarding the dependences of the servers, or to redistribute to lists, requires prior specific permission and/or a fee. index of refraction, and propose a partial solution to the Request permissions from Permissions Dept, ACM Inc., fax +1 (212) 869-0481 or e-mail [email protected]. problem using the general equation, based on Fermat’s © 2004 ACM 1-58113-967-5/04/0004 $5.00 97 principle, that describes the phenomenon. None of forward ray tracing, or obtaining shadow rays in these works, though, can successfully follow the bidirectional path tracing would face the same basic complete light paths: from the lights through problem as with backward ray tracing: to find a curve inhomogeneous media to interaction with geometry, that passes through two given points while obeying the through inhomogeneous media again before finally nonlinearities of the medium. reaching the eye. The basic problem of following all Groeller [1995] proposes several solutions to this these paths is explained in the next section. problem: the first one supposes that the light rays are This paper describes a global illumination solution only curved from the eye to the intersection point, but based on what the authors call curved photon mapping travel in a straight line from the intersection point to techniques. The basic algorithm is explained in the next the light source. The second solution consists in section. Section 3 describes an atmosphere profile assigning color to the intersection point regardless of manager to set up the scenes according to the the light sources, for instance by using textures with phenomenon that needs to be simulated. The algorithm the illumination already pre-calculated. These are is validated through several test images in Section 4, obvious simplifications that will work well for general while Section 5 presents the green flash and our work image synthesis, but do not reflect the physics of the on the Human Visual System and the bleaching of system. The second solution is in fact used in [Serón et photoreceptors in the eye. The results are shown in al. 2002], since the authors concentrated mainly on Section 6, and the future work is discussed in Section solving the general equation accurately. Another idea is 7. to voxelize the space and get the approximate direction of incoming light by shooting light rays through the 3 Curved photon mapping voxels from each light, saving the results in a pre- computed structure. As far as the authors know, there is Traditionally, light travelling trough inhomogeneous not much more literature regarding this problem. media has been simulated by using ray tracing Since neither a pure backward, forward nor bi- techniques [Glassner 1989]. Basically, in backward ray directional ray tracing solution seems viable for tracing, a ray is shot from the eye into the scene until it inhomogeneous media where rays get curved, we reaches an object, and from that intersection point more sought a combined approach, creating a rendering rays are shot towards the lights to find the color of the environment named Lucifer, based on photon mapping corresponding pixel. techniques. This works well for homogeneous media, where the Photon mapping is a two-pass algorithm [Jensen 2001]. light rays travel in a straight path. But the situation In the first pass photons are shot from each light into changes when using curved ray tracing: curving the eye the scene, and traced as they interact with the ray until it reaches an object in the scene is geometry. In each collision, the Russian Roulette conceptually simple. We do not know where each ray algorithm decides whether each photon is absorbed, is going to end up after being curved by the medium, reflected or transmitted. When the photon hits a diffuse but we do not care either, since it will eventually hit material, it is stored. The data structure that stores all some object or be lost in infinity, just as with straight these photons is called the photon map. The second ray tracing. The problem arises when shooting pass consists on a modified ray tracing algorithm, but additional rays from the intersection point to the lights. instead of shooting shadow rays, radiance is estimated Even though we know both the start and end points of from the nearest stored photons around the intersection the ray, it is difficult to find a curve that passes through point. Specular reflections are obtained by standard ray those two points while also obeying the nonlinearity tracing, since the probabilities of a photon being caused by the inhomogeneous medium. Just shooting reflected in the exact specular direction towards the eye rays hoping one will eventually hit the light is are infinitesimal. obviously very ineffective. This is a problem similar to The photon mapping algorithm allows a full global computing caustics by using path tracing or any other illumination simulation, including color bleeding and backward ray tracing method. Caustics are caustic generation. As we are going to see, it can also concentrated light reflections on diffuse surfaces be adapted to inhomogeneous media, by calculating the caused by refraction through transparent surfaces, and curved trajectory of the photons during the photon to simulate them in the image it would be necessary to tracing phase.