Ray Tracin Question (dull)

Ray Tracin Question (dull)

Post by shir.. » Tue, 02 Jan 1990 16:59:00

I was wondering if anyone has an ELEGANT solution to my ray tracing
problem:  how should I handle to clear objects that touch.

Here is my typical treatment without this:

         function ray(origin, direction, IO) {returns color}
            if an object OB is hit
               if OB->transparent
                   if IO is INSIDE {OB}
                        incident index of refraction = OB->index_R
                        transmitted index = 1.0
                        incident index of refraction = 1.0
                        transmitted index = OB->index_R
                 < other junk >

                return (direct_lighting +
                        OB->ks*ray(new_origin, reflection_dirction, IO) +
                        OB->kt*ray(new_origin, refraction_dirction, !IO))
               return background(origin, direction)

This works just fine.  When I use a CSG ray tracer it's even easier:  the
IN/OUT lists handle the IO bookkeeping automatically.  Now here is the problem:
Suppose I want a clear glass filled with water.  In my CSG program I have a
very ugly kludge:  If two objects have a separation less than some constant,
then they are considered to be touching, and the refraction is calculalated
accordingly.  For the code above (presumably with polygon primitives), I
could add a 'current indexR' parameter in the ray list, and assume that
any if OB has a different index_R, it is at an interface.  My only trouble
with this is that I'll have to be careful when modeling.  For example, the
glass would have to be modeled:

                    ***        ***
                    * *        * *      * = glass
                    * *        * *      ~ = water
                    * ~~~~~~~~~~ *
                    * ~        ~ *
                    * ~        ~ *
                     * ~~~~~~~~ *

It bothers me that I have to understand the guts of my renderer when
doing the modeling.  Does anyone have a good (or different) way of
handling this?  I've never seen anything in print on such details.  Has
anyone else?


Peter Shirley
U of Illinois at UC


1. Newbie question - can POV-Ray be used for single rays of light

I am trying to find an application that will send a load of light rays or a
single ray into a tube and then visualise what comes out, can POV-Ray do
this? The surface is probably going to be reflective in the first instance,
if this helps.

Thanks for any ideas


2. Corel 10 full version in German magazine!!!

3. Make a dull, cloudy sky look clear blue.

4. DirectX 9 Link