Path: utzoo!utgpu!watmath!clyde!att!rutgers!mailrus!ncar!noao!amethyst!spock!chris
From: chris@spock (Chris Ott)
Newsgroups: comp.graphics
Subject: Village Idiot asks about Ray Tracing
Message-ID: <859@amethyst.ma.arizona.edu>
Date: 5 Dec 88 23:39:36 GMT
Sender: news@amethyst.ma.arizona.edu
Reply-To: chris@spock.ame.arizona.edu (Chris Ott)
Organization: Computer-Aided Engr. Lab (CAEL), University of Arizona, Tucson
Lines: 93



ewhac@well.UUCP (Leo 'Bols Ewhac' Schwab) writes:

>	I was doing a few gedanken experiments with raytracing, and came up
> with a few questions.  Realize that I've never written a raytracer.

     I'm writing a ray tracer right now and have some experience.

>	Suppose I have an object, a light source, and a flat surface set up
> as a perfect mirror.  Suppose further that I have a thing between the object
> and light source preventing direct illumination of the object.  Suppose
> further still that the "mirror" is set up to reflect the light from the
> light source to the object.  Question:  Will the object be illuminated?
> Does it depend on whose software I'm using?

     Software that does true ray tracing would definitely illuminate the
object. For example, the ray could be sent from the eye through a specific
pixel on the screen to the object, bounce off the object into the mirror,
and finally, off the mirror into a light source. Then, given the color of
the object and the light source, the pixel's color can be computed. At
least mine works this way. The way my code looks, it seems as if this
would be intrinsically part of ray tracing, i.e. I didn't have to make
a special case for mirrors.

>	Suppose I have a flat surface, a light source, and an object in the
> shape of a convex lens above the surface under the light.  Suppose further
> that the object is set up to be perfectly clear, and refracts light like
> glass.  Question:  Will the light beneath the lens object be intensely
> focused on the surface below, just like a real lens?

     Again, true ray tracing would definitely produce this result.

Then ranjit@eniac.seas.upenn.edu (Ranjit Bhatnagar) writes:

# It depends on the software - most ray tracers do NOT model reflected light,
# because of the tremendous increase in complexity.  The standard shadow
# model casts a ray from the object's surface to each light source, to
# see if there's an object in the way.  To test for reflected light,
# you have to cast rays in EVERY DIRECTION, just in case there's a mirror
# in that direction that might be reflecting light on this part of
# the object surface.  Even if you optimize it to cast rays only
# at known mirrors, you still need to cast an infinite number towards
# each mirror.  
#
# A nice application of stochastic techniques is to cast a moderate
# number of rays in RANDOM directions, hoping that they will hit a mirror
# if there's one to hit.  If the jitter is done well, then the effect
# will not be bad.

     This does not sound correct to me. My understanding is that the only
rays we are interested in are the ones that the eye can see, so we just
need to cast a ray (more than one, if we want some reasonable anti-aliasing)
from the eye-point through each pixel. At least that's the way I did it
and it gives very realistic results. Any comments?

>	The point of the above two questions is to find out if, in general,
> raytracers handle illumination from light bounced off of or refracted
> through other objects.

     Yes.

>	Finally, has anyone come up with a raytracer whose refraction model
> takes into account the varying indicies of refraction of different light
> frequencies?  In other words, can I find a raytracer that, when looking
> through a prism obliquely at a light source, will show me a rainbow?

     This could be tough. The red, green, and blue components of monitors
only simulate the full color spectrum. On a computer, yellow is a mixture
of red and green. In real life, yellow is yellow. You'd have to cast a
large number of rays and use a large amount of computer time to simulate
a full color spectrum. (Ranjit pointed this out in his article and went
into much greater detail).

>	Something tells me that all three questions are rather hard.

Nah. They were easy.

> Leo L. Schwab

#	- Ranjit

Chris Ott


-------------------------------------------------------------------------------
 Chris Ott
 Computational Fluid Mechanics Lab            Just say "Whoa!!" and
 University of Arizona                          vote for Randee!!

 Internet: chris@spock.ame.arizona.edu
 UUCP: {allegra,cmcl2,hao!noao}!arizona!amethyst!spock!chris
-------------------------------------------------------------------------------