Section 4.8.4.5
Adding Light Attenuation

Transparent objects can be made to cause the intensity of light passing through them to be reduced. In reality, this is due to impurities in scattering the light. Two float values determine the effect: fade_distance is the distance the light has to travel to reach one-half its original intensity and fade_power is the degree of falloff. Let's try an example of this.

sphere { <0,0,0>, 1 pigment { White filter 1 } finish { ambient .1 diffuse .1 reflection .15 refraction 1 ior 1.45 specular 1 roughness .001 fade_distance 5 fade_power 1 } }


The caustics of a translucent sphere.

This gives the sphere a slightly clouded look as if not all of the light was able to pass through it. For interesting variations of this texture, try lowering ior to 1.15 and raising reflection to 0.5.


Section 4.8.4.6
Using Faked Caustics


Section 4.8.4.6.1
What are Caustics?

First, let us raid our kitchen cupboard. We are looking for transparent glass or crystal drinking glasses. If they have a pattern etched in their surface, so much the better. One by one, we place them under a bright lamp and observe the shadow they cast on the desk or table beneath. If we look closely we will make out bright regions within the shadow. These will be places where the refractive properties of the drinking glass are concentrating light sufficiently to make the bright spots. If there is a pattern in the surface of the glass we will see the pattern formed out of the bright areas. Those bright regions are the caustics caused by refraction, the refractice caustics. There will also be bright patterns of light on the table that are caused by light reflected off the glass. These are called reflective caustics.

Once we know what we are looking for we will be able to spot caustics in many everyday situations: the shadow cast by a magnifying glass has one, light streaming through an aquarium might makes them, the light passing through a piece of crumpled cellophane might cast them on the table top, etc. We will even see them in the bottom of a swimming pool on a bright sunny day. Caustics are a subtle lighting effect that can really lend realism to raytraced images of such items.

POV-Ray uses algorithms that fake refractive caustics (reflective caustices are not possible).There are inherant limitations on the process of (standard) ray-tracing in general which make it unsuitable for certain light simulation applications, such as optical testing and a few very particular architectural lighting projects. Methods which do the considerably more extensive calculations needed to do full light simulation including caustics (like path-tracing, photon-tracing or bi-directional ray-tracing) are very slow and impractical on average platforms.

This means that we have to tinker with the caustics to get the best possible look, but with a little experimentation, we will see we can very closely emulate the real thing. The best way to go is, where ever possible, to study an example of the thing we are trying to trace. We need to get to know its pattern of caustics and then adjust our final picture until we are satisfied.


Section 4.8.4.6.2
Applying Caustics to a Scene

Caustics is a new texture property under the area of finishes. We apply it to the shadows of a transparent, refractive object by adding in the caustics keyword to the finish. We try the following simple example for a start (see file caustic1.pov).

#include "colors.inc" #include "textures.inc" camera { location <0, 15, -40> look_at <-2, 0, 1> angle 10 } light_source { <10, 20, 10> color White } // lay down a boring floor to view the shadow against plane { y, 0 pigment { Grey } } // here's something to have caustics property applied sphere { <0, 3, 0>, 2 texture { Glass3 finish { caustics .6 } } }


The caustics in a swimming-pool.

When we render this we will see our sphere in the upper right corner of the image, floating a little over the plane, and the shadow it casts is sprawled across the central part of our view. And there in the center is a basic caustic. That bright area in the center represents the light which normally refractivity would concentrate in the middle of the shadow.

The only question this leaves is: what is with the floating point value which follows the caustics keyword? Well, that's where our discussion above on adjusting the caustic comes in. Remember the drinking glasses? If we had one that had fairly thin walls and then a thick glass base we will see what we mean in the shadows it casts. Above, with the thinner walls (with less refraction) the caustics are less pronounced and more evenly diffused through the shadow, but when we get to the part of the shadow cast by the thicker, more refractive base, suddenly the caustic becomes more pronounced and more tightly focused near the center.

Of course, since this is a simulated caustic, there is no correspondence between the degree to which the caustic is focused or diffused and the shape, size and refractivity of the object. But we can manually control it with the floating point value following the caustic keyword. The closer this value gets to zero, the more diffused and dimmer the caustic gets, while the nearer it becomes to 1, the more tightly focused and pronounced the caustic gets. At 1, we have the caustic of a thick, highly refractive piece of lead crystal, while at 0.1 it is more like a hollow glass sphere. We try this by re-rendering the above scene, with a range of values from 0.1 to 1.0 and watching the different caustics we get.

Out of range values work also. Numbers higher than 1 just lead to more and more tightly focused caustics. Negative numbers are just plain weird, but interesting. Essentially, the object becomes illuminated in all sorts of bizzare ways and the shadow becomes like a photographic negative of itself. Kind of like a 1950's sci-fi raygun effect. It looks strange, and not at all photo-realistic, but if we like the surreal we may want to try it at least once and file away the effect in our mind in case we ever want it.


Section 4.8.4.6.3
Caustics And Normals

POV-Ray makes use of surface normal perturbation in a way that is more unique than people generally stop to think. When we apply a surface normal in a texture we are actually not altering the surface at all, but rather telling POV-Ray to treat the surface as if it were altered, for purposes of computing the illumination falling on each individual spot. In short, it is a trick of the light and shadow which, supposing only that we don't see it at too sharp a viewing angle, effectively creates the illusion of distortions in the surface of an object.

Caustics are also a synthetic trick, as we saw above, and sure enough, they have been designed to react to texture normal patterns as if those patterns were genuinely there. Remember the drinking glass experiment? If we found a glass with patterns etched into the surface we probably noted that the pattern showed up in the caustics cast by the glass too. When we have a transparent surface with a normal applied to it, it causes the caustics cast by that surface to mimick the normal pattern, so that it shows up in the shadows.

Following is an example of what we mean: it is a simply meant to represent water in a swimming pool. We have distilled this down to a plane above to represent the water, one below to represent the floor of the pool, a camera just below the waterline, looking at the floor, and a light source high above (see caustic2.pov).

#include "colors.inc" // Our camera is underwater, looking at the bottom of // the pool for the best view of the caustics produced camera { location <0, -5, 0> look_at <0, -10, -5> } light_source { <0, 100, 49.5> color White } // the bottom of the pool... plane { y, -10 texture { pigment { color rgb <0.6, 0.7, 0.7> } finish { ambient 0.1 diffuse 0.7 } scale 0.01 } } // and the surface of the water plane { y, 0 texture { pigment { rgbf <0.6, 0.67, 0.72, 0.9> } normal { bumps .6 scale <.75, .25, .25> rotate <0, 45, 0> } finish { caustics .9 } } }

The bumps we have given the water plane are meant to represent the small, random crests and troughs that form on a pool when a light breeze blows over it. We could have used ripples or waves as well, like something had recently splashed into it at some point, but the bumps will work well enough for an example.

We notice that our view of the pool floor shows dozens of tiny caustic light spots, corresponding approximately to a random bump pattern. If we like we can try putting in ripples or waves and watch the pattern of the caustics change. Even though a flat plane itself would cast no caustics (we could try without the normal), POV-Ray's faked caustic generation knows that if the surface was really bumped like this normal is indicating, the refraction of the bumped surface would be just enough to concentrate light in caustics throughout the bottom of the pool.

We see that just as with a curved surface, such as the sphere previously, normal patterns also trigger the appearance of caustics cast by an object. Interestingly enough, this alone would be proof that the caustics really are faked: our water hasn't even been given any refraction properties in its finish, yet the caustics are still there just the same!


Next Section
Table Of Contents