[comp.graphics] Ray tracing and caustics.

peter@sugar.UUCP (Peter DaSilva) (06/25/87)

I was looking at a beautiful ray-traced image not so long ago and wondering
why it looked less than real. There was something wrong with a transparent
object in it. I had to refer to a *real* transparent object to figure out
what it was: it had a nice diffuse shadow, but there was no caustic in and
around the shadow from the refraction of light rays from the light source.

It has occurred to me that I have never seen such an effect in ray-traced
images. It shouldn't be too hard: you would have to reverse ray-trace from
the light source for each transparent object and add the caustic to the
texture map for each matte object it eventually falls on. Has anyone
considered doing this?

If this does lead to any breakthroughs, would this be the first time a usenet
message was a reference in a technical paper :->?

david@sun.uucp (David DiGiacomo) (07/10/87)

In article <219@sugar.UUCP> peter@sugar.UUCP (Peter DaSilva) writes:
>It has occurred to me that I have never seen such an effect in ray-traced
>images. It shouldn't be too hard: you would have to reverse ray-trace from
>the light source for each transparent object and add the caustic to the
>texture map for each matte object it eventually falls on. Has anyone
>considered doing this?

Yes.  Take a look at the last illustration in Jim Kajiya's paper "The
Rendering Equation" in the Siggraph '86 proceedings.

P.S. Why is this paper illustrated by two tiny images surrounded by a
vast expanse of blank paper?  Grrr.

cmr@cvedc.UUCP (Chesley Reyburn) (07/11/87)

>why it looked less than real. There was something wrong with a transparent
>object in it. I had to refer to a *real* transparent object to figure out
>It has occurred to me that I have never seen such an effect in ray-traced
>texture map for each matte object it eventually falls on. Has anyone
>considered doing this?

Henri Matisse (among others) noticed this around 1890. This is (I beleive)
the entire basis for 'impressionism'.

cmr

jon@oddhack.caltech.edu (Jon Leech) (07/12/87)

Summary:

Expires:

Sender:

Followup-To:

Distribution:

Keywords:


In article <494@cathy.cvedc.UUCP> cmr@cvedc.UUCP (Chesley Reyburn) writes:
>>why it looked less than real. There was something wrong with a transparent
>>object in it. I had to refer to a *real* transparent object to figure out
>>It has occurred to me that I have never seen such an effect in ray-traced
>>texture map for each matte object it eventually falls on. Has anyone
>>considered doing this?
>
>Henri Matisse (among others) noticed this around 1890. This is (I beleive)
>the entire basis for 'impressionism'.

    Jim Blinn is fond of saying that everything in computer graphics
was first done before the 20th century. I guess this proves it ... ray
tracing in 1890 :-)

--
    Jon Leech (jon@csvax.caltech.edu || ...seismo!cit-vax!jon)
    Caltech Computer Science Graphics Group
    __@/

SUSHIDO - The Way of the Tuna

amamaral@elrond.CalComp.COM (Alan Amaral) (07/13/87)

In article <219@sugar.UUCP>, peter@sugar.UUCP (Peter DaSilva) writes:
> what it was: it had a nice diffuse shadow, but there was no caustic in and
> around the shadow from the refraction of light rays from the light source.
> It has occurred to me that I have never seen such an effect in ray-traced
> images. It shouldn't be too hard: you would have to reverse ray-trace from

It's been done by several people.  The one that I've been most impressed
with is the Rendering Equation by Jim Kajiya.  Basically, it is an
extension of distributed ray tracing that handles things like caustics
and subtle interactions of light bouncing from one surface to another
(i.e. light bouncing off of a red wall onto a white wall causing a pink
area to be formed).  The really neat thing about the rendering equation
is that it can be incorporated into a standard ray tracer without major
change.

It's written up in the '86 Siggraph conference proceedings.



-- 
uucp:	 ...decvax!elrond!amamaral		I would rather be a
phone:	 (603) 885-8075				fool than a king...
us mail: Calcomp/Sanders DPD (PTP2-2D01)
	 Hudson NH 	03051-0908

amamaral@elrond.CalComp.COM (Alan Amaral) (07/13/87)

In my last posting I might have given the mistaken impression that the
rendering equation does reverse ray tracing.  This is not the case.  It
works using distributed ray tracing techniques, but instead of creating
a ray tree consisting of refracted, AND reflected, AND other rays it ONLY
picks one ray to follow using monte carlo techniques.  Also, instead of
picking very few initial rays and relying on many second, third, forth,
etc. generation rays (it is interesting to note that they really
contribute much less to the pixel than do the first generation rays)
it picks a larger number (i.e. ~40) of first generation rays distributed
properly.

By the way, it's not obvious, but caustics basically fall out of this
automatically because as a ray hits an object another ray is generated
(randomly, direction based on the reflectivity of the intersected object)
and if the intersection point is close to another object (a transparent
sphere for example), it will intersect the sphere some of the time,
thus picking up illumination from it.  This also happens with objects
that are not transparent, and this mimics radiosity results closely.

-- 
uucp:	 ...decvax!elrond!amamaral		I would rather be a
phone:	 (603) 885-8075				fool than a king...
us mail: Calcomp/Sanders DPD (PTP2-2D01)
	 Hudson NH 	03051-0908

scofield@apollo.uucp (Cary Scofield) (07/13/87)

In article <219@sugar.UUCP> peter@sugar.UUCP (Peter DaSilva) writes:
>
>It has occurred to me that I have never seen such an effect in ray-traced
>images. It shouldn't be too hard: you would have to reverse ray-trace from
>the light source for each transparent object and add the caustic to the
>texture map for each matte object it eventually falls on. Has anyone
>considered doing this?
>

See:

    "Backward ray tracing" by James R. Arvo

    "Reflection and refraction model for ray tracing" by Masa Inakage

both of the above papers are in the 1986 SIGGRAPH Course Notes volume
entitled "Developments in Ray Tracing".


Also see:

    "The Rendering Equation" by James T. Kajiya from the 1986 SIGGRAPH
    Proceedings, pp. 143-150.


Arvo's paper describes, in detail, an algorithm pretty close to your idea.
In Kajiya's paper, the caustics were a natural by-product of the 
his terra-flop rendering algorithm.   If you're inclined to "cheat", use Arvo's 
method -- it's much faster, even if a little cumbersome to implement.





-- 
Cary Scofield - Graphics Software          decvax!wanginst!apollo!scofield
Apollo Computer Inc.
270 Billerica Road
Chelmsford, MA 01824

skinner@saturn.ucsc.edu (Robert Skinner) (07/13/87)

In article <219@sugar.UUCP>, peter@sugar.UUCP (Peter DaSilva) writes:
> I was looking at a beautiful ray-traced image not so long ago and wondering
> why it looked less than real. There was something wrong with a transparent
> object in it. I had to refer to a *real* transparent object to figure out
> what it was: it had a nice diffuse shadow, but there was no caustic in and
> around the shadow from the refraction of light rays from the light source.


See Jim Kajiya's 'Rendering Equation' paper in the Siggraph '86 proceedings.
It has an image with caustics, and caustics were mentioned repeatedly in the 
Advanced Image Synthesis tutorial that year (I'm told).  

Kajiya's paper describes the equations for solving all rendering problems, 
which includes radiosity, caustics, color bleeding, etc.  He never 
explicitly says in the paper how these effects were accomplished, 
but it seems like they trace multiple rays in random directions from 
any ray/surface intersection.  If these rays intersect an illuminated surface,
they contribute to the illumination of the first surface, just like a
light source, hence you get color bleeding (see the underside of the 
upright structure in the above mentioned image).  
If the ray happens to hit a light after refraction through
a glass ball, the highlight will be reflected and will appear as a caustic.

Seems plausible, but does anyone REALLY know how Kajiya does it?
How are these extra rays chosen?  How many are used?  
etc, etc.

Robert Skinner
skinner@saturn.ucsc.edu

cmr@cvedc.UUCP (Chesley Reyburn) (07/14/87)

>>In article <494@cathy.cvedc.UUCP> cmr@cvedc.UUCP (Chesley Reyburn) writes:
>>Henri Matisse (among others) noticed this around 1890.

OK, OK, all caustics aside :-}, it was Degas, Manet and Monet and it was
in the 1850s.

shirley@uiucdcsm.cs.uiuc.edu (07/17/87)

I was also in the dark about the nuts & bolts of path tracing after
reading Kajiya's paper.  I was able to ask him for more detail
after a talk he gave at the last SIGGRAPH conference.  I asked him
how a caustic appears under a clear sphere with his method.  He
said (approximately):

    Many rays are sent from the eye point through a pixel and hit
    the matte surface under the sphere.  For each ray, a shadow
    ray is sent toward the light source, and since they are blocked
    by the sphere there is no direct lighting contribution.  A 
    reflection ray is also generated for each primary ray and some 
    will hit the clear sphere and be refracted (twice) and hit the
    light source.  This causes a large brightness contribution
    for those rays, which averaged in with the "dead" rays gives
    you the correct brightness for the caustic.
    
This leads to two obvious questions:  how are the reflection rays
chosen, and how bright is the "large contribution"?  Also you should 
note that if a reflection ray from a matte surface hits a light
source DIRECTLY, no extra contribution should be added, because
the direct lighting term was already calculated directly.

I have modified my ray tracer to "path trace" and the results are
nice, but (not suprisingly) noise is a real problem unless MANY
rays are used, especially when caustics are involved.  


Peter Shirley
U of Illinois at UC

cjp@vax135.UUCP (Charles Poirier) (07/17/87)

In article <543@saturn.ucsc.edu> skinner@saturn.ucsc.edu (Robert Skinner) writes:
<See Jim Kajiya's 'Rendering Equation' paper in the Siggraph '86 proceedings.
<It has an image with caustics, and caustics were mentioned repeatedly in the 
<Advanced Image Synthesis tutorial that year (I'm told).  
<
<Kajiya's paper describes the equations for solving all rendering problems, 
<which includes radiosity, caustics, color bleeding, etc.  He never 
<explicitly says in the paper how these effects were accomplished, 
<but it seems like they trace multiple rays in random directions from 
<any ray/surface intersection.  If these rays intersect an illuminated surface,
<they contribute to the illumination of the first surface, just like a
<light source, hence you get color bleeding (see the underside of the 
<upright structure in the above mentioned image).  
<If the ray happens to hit a light after refraction through
<a glass ball, the highlight will be reflected and will appear as a caustic.

I'm just a beginner at this; furthermore I haven't read the paper by
Kajiya, but I'll be bold and make a suggestion.  I'll refer to the
random rays from the original ray/surface intersection as "secondary
rays." If you are using light sources which are small and/or distant
sources, the chance of a random secondary ray passing through a
refractor and hitting such a source is small or nil.  I would expect
the resulting caustics to look rather noisy or grainy.

Rather than generate purely random secondary rays, it seems like one
could flood all potential caustic generators (such as a glass sphere)
with a proportionally larger number of secondary rays (in addition to
having some random rays, for color bleeding). This would reasonably
model the focusing of light coming from different parts of the sphere.
Of course, since the secondary rays are now non-isotropic (as opposed
to purely random secondary rays which are, hopefully, isotropically
distributed), you will have to average down the results of these rays
to represent uniform rays-per-degree.

One could generalize this method a bit.  How about sending *all*
secondary rays out explicitly towards objects in the scene, rather than
at random?  Say, allocate a number of rays per degree of object,
modified per object depending on the properties of that object.  Say,
more rays for objects that are transparent or specularly reflective or
highly matte-reflective (the latter is meant to improve the efficiency of
color bleed collection)?  Within the bounds of each target object, the
allocated number of rays could be randomly distributed.

My guess is that such a scheme would get more accurate caustics and
color bleeding than purely random secondary generation.  Of course
there is overhead involved in allocating and aiming the rays.  But they
would be more "efficient", hence one could use a small fraction of the
number needed for random rays.

I welcome any comments or guesses as to whether this scheme is of any use.

	Thank you,
-- 
	Charles Poirier   (decvax,ucbvax,ihnp4,attmail)!vax135!cjp

   "Docking complete...       Docking complete...       Docking complete..."

childs@cadnetix.UUCP (David Childs) (07/17/87)

In article <1037@elrond.CalComp.COM>, amamaral@elrond.CalComp.COM (Alan Amaral) writes:
: It's been done by several people.  The one that I've been most impressed
: with is the Rendering Equation by Jim Kajiya.
: ...
: It's written up in the '86 Siggraph conference proceedings.

Jim Kajiya has actually been doing quit a bit with ray-tracing and the likes.
Has anyone seen anything done by him (and various others) in OmniMax Theaters.
An Omnized picture looks rather interesting on a crt.  I took a class from
Jim, but it was only compiler design, no graphics.  :-( Anyone seen a version
of his fifth. (super forth)

Where can I get a copy of Siggraph conference proceedings?

Thanks in advance.

David Childs @ Cadnetix Corp   childs@cadnetix.UUCP
...!seismo!hao!ico!cadnetix!childs

peter@sugar.UUCP (Peter da Silva) (07/19/87)

Although Isaac Newton did a rather good writeup of the effect in Optiks. :->
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)

peter@sugar.UUCP (Peter da Silva) (07/19/87)

> > [i made the original comment about caustics]
> [an explanation of how someone did them, probably by taking a random
>  sample of vectors from any ray intersection with a matte surface]

I thought of that, but assumed that it would lead to too much overhead.
In most scenes you're not likely to get many caustics from non-reflective
or transparent objects, which is why I suggested doing a pre-trace pass
originating at the light source to paint the caustics on matte surfaces.
Not nearly as accurate a technique, but likely much faster. Of course I could
be completely wrong about the speed problem. It's been known to happen.
-- 
-- Peter da Silva `-_-' ...!seismo!soma!uhnix1!sugar!peter (I said, NO PHOTOS!)

skinner@saturn.ucsc.edu (Robert Skinner) (07/20/87)

In article <4400009@uiucdcsm>, shirley@uiucdcsm.cs.uiuc.edu writes:
> (Kajiya) said (approximately):
> 
>     Many rays are sent from the eye point through a pixel and hit
>     the matte surface under the sphere.  For each ray, a shadow
>     ray is sent toward the light source, and since they are blocked
>     by the sphere there is no direct lighting contribution.  A 
>     reflection ray is also generated for each primary ray and some 
>     will hit the clear sphere and be refracted (twice) and hit the
>     light source.  This causes a large brightness contribution
>     for those rays, which averaged in with the "dead" rays gives
>     you the correct brightness for the caustic.
>     

I still need some clarification.. Suppose the image is set up like this:

			(Reflected Ray)
			     ^ 
		             .	-
			     . |S|		<-- Light
				-
				
			     ^
			     |
			     Eye

Where the 'S' is a glass sphere.
If a ray is traced from the Eye to the left of the Sphere where the shadow 
and caustic should appear, the reflection ray goes up in the direction 
indicated, NO?  This is should not intersect the Sphere or the Light, so 
how can this create a caustic?

Is the term 'reflected ray' a misnomer?  Are we talking about a different 
sort of ray than the usual 'reflection ray'?
I have yet to hear an explanation more satisfying than the following:

	Standard shadow tracer rays are used to generate the regular 
	shadow.  In addition, a number of random rays are traced away
	from the surface in random directions, hoping to hit some
	(indirect) light source, such as a brightly illuminated surface
	nearby.  The rays that are refracted twice through the sphere and
	hit the light source contribute to the caustics.


Once again, How are these 'reflected rays' chosen?  This seems to be 
Mr Shirley's question, but the overloading of the term reflected is
very confusing here.


Robert Skinner
skinner@saturn.ucsc.edu

(nothing cute here until I get my USENET act back together)

mason@tmsoft.UUCP (08/08/87)

I just today saw a complete treatment of Caustics in:
	Masa Inagake, The Visual Computer, Vol 2, No 6
Published by Springer Verlag.

	../Dave Mason,	TM Software Associates	(Compilers & System Consulting)
	..!{utzoo seismo!mnetor utcsri utgpu lsuc}!tmsoft!mason