[comp.sys.amiga] Problem with intersecting glass spheres in Turbo Silver SV.

sutherla@qtp.ufl.edu (Scott Sutherland) (08/01/90)

	I saw a posting on comp.graphics (I believe) from someone who was
having problems finding a ray-tracer which would be able to render the
intersection of 2 glass spheres correctly.  He wants a blue and a green glass 
sphere (one 50% transparent and the other 75% transparent) to be ~25% overlapping.
He said that he had tried many ray tracers but none had worked for getting the
area of intra-penetration.  I responded to this article by saying that I thought
Turbo Silver SV would be able to do the job, and I decided to try it.  Several 
months ago there was a posting concerning glass and TS, so I used that 
information to choose my settings.  I decided to make the spheres 100 percent
transparent for testing purposes.  However, I ran into a problem.  Below is the
letter I sent to the person. It explains to the best of my ability what I got
as a result.  I would appreciate it if any Turbo Silver gurus out there could
help me figure out if my result is my fault (bad parameters) or if I chose a 
tracing problem too complex for TS.  I am using an A3000 for this.

****************************************************************************



Well, I tried my first traces last night.  Although I am not ready to give up,
the results I got were dismal.  First of all, let me tell you what parameters 
I have to play with.  I can set the color values for R, G, and B separately from
0-255 (NOTE: several of the value ranges can be set to this range, but the 
standard Amiga can only display 16 shades of each color (4096 total).  The 
software can generate 24-bit images (hence the 0-255) for viewing with a frame
buffer or other comparable hardware display option).  I can also set the 
reflective and filter (transparency) values of R, G, and B separately from
0-255.  I can set the specular reflection value from 0-255 and the hardness
(how "tight" the specular spot is) from 0-32.  I can set the resolve depth
(has to do with multiple reflection calculations) from 0-15.  The other 
parameters I can alter have to do with blending of colors for dithering, 
the roughness of objects, and edge levels (degree of anti-aliasing).  Since 
these latter parameters should not affect what you are interested in, I will
not discuss them further.  I can also set the index of refraction from 1-3.5.

Okay, for glass, it was recommended that I use the following (in a post to 
comp.sys.amiga a few months ago).

Color:  Your choice (255 on all guns for a colorless glass).
Reflective: 0 on all guns.
Filter: 255 on all guns (this means it passes all light.  I do not think I 
        should use these values for the colored spheres, but I tried it first
	anyway.
Specular: 200
Hardness: 25
Resolve Depth: 15

I did not have your letter with me so I forgot that you wanted blue and green,
so I tried red and blue.  I first tested the above parameters with one sphere
and NO color.  I put a B&W grid ground below the sphere to see the refraction
effect, set the index to glass (~1.55), added one light source (with distant
dependent illumination) and rendered it.  This came out nice.  I then colored
it red.  The sphere comes out with a red hue, but, since the Filter is set to
255 on all guns, the white of the grid below looks white.  Next I added another
sphere, NOT intersecting with the first, and colored it blue.  Similar results
to the first one.  Now for the fun (and frustrating) part.  I physically 
overlapped the 2 spheres by ~25%.  Then I rendered it.  The results are, to say
the least, unexpected and BIZARRE.  I will try to describe them.  Picture the
blue sphere on the left, the red on the right.  Now, the part of the blue 
sphere that is "inside" the red sphere has had 2 things happen to it.  First,
the image of this sphere section is distorted (due to the refraction) as viewed
through the red sphere.  Second, it has now become completely OPAQUE!!  The same
thing happened to the red sphere.  So, I will try to draw the result below
(ascii characters leave a lot to be desired for this).


		----------------    ----------------
	       /		\  /		    \
	      /			 \/		     \
	     /			 /\		      \
	    |			|  |		       |
	    |			|  |		       |
	    |	  BLUE		|  |	RED	       |
	    |			|  |		       |
	     \			 \/		      /
	      \			 /\		     /
	       \		/  \		    /
		----------------    ----------------



		----------------    ----------------
	       /	       /\  /\		    \
	      /		      |	 \/  |		     \
	     /		      |	  |  |		      \
	    |		      |	  |  |		       |
	    |		      |	SR|SB|		       |
	    |	  BLUE	      |	  |  |	RED	       |
	    |		      |	  |  |		       |
	     \		      |	  |  |		      /
	      \		       \ /\ /		     /
	       \		/  \		    /
		----------------    ----------------
	
	
The non-overlapped areas still render perfectly.  SR and SB stand for solid
(opaque) red and solid blue, respetively.  Note that what I am trying to show,
besides the solid color, is that the part of the blue sphere which is actually
inside the red sphere is SMALLER than the actual SB area which is seen in the
rendering (I believe due to the refraction distortion).  Also, the SR and SB
areas are supposed to be the same size but the ASCII characters I am using made
it hard to get that center line perfectly lined up.

I called Impulse, the company who makes the ray tracer I am using.  They could
not give me an answer over the phone, but they asked me to send them a disk
with the IFF image and all the data and parameters I used so that they could
look into it for me.  I do not blame them for not giving me an answer over the
phone, since it is very hard to describe the effect shown above (I hope that 
I made it clear here).  I will take them up on it since this is a major problem
if it is the ray tracing code and not my misunderstanding of the parameters 
involved.  

Let me know if you have any idea what would cause this.  Also, I know I asked 
this before, but what are you hoping to see?

More later.

Scott Sutherland 
sutherla@qtp.ufl.edu      


****************************************************************************

Any help would be appreciated.  Could someone else try this and see if they
get the same result?  

Thanks, 

Scott Sutherland
sutherla@qtp.ufl.edu

swarren@convex.com (Steve Warren) (08/02/90)

In article <1095@orange3.qtp.ufl.edu> sutherla@qtp.ufl.edu (Scott Sutherland) writes:
                                [...]
>blue sphere on the left, the red on the right.  Now, the part of the blue 
>sphere that is "inside" the red sphere has had 2 things happen to it.  First,
>the image of this sphere section is distorted (due to the refraction)as viewed
>through the red sphere.  Second, it has now become completely OPAQUE!!The same
>thing happened to the red sphere.  So, I will try to draw the result below
                                [...]

Well, try placing a flat transparent blue plane behind a flat transparent
red plane.  I think you will find in this case that the area of overlap will
also be opaque.  This is because the blue light coming from the blue
transparent plane cannot pass through a red "filter" (a red transparent
plane would filter out all light except red).

I think that what you are seeing is what this would really look like, if you
could intersect two colored glass spheres like this.

--
            _.
--Steve   ._||__      DISCLAIMER: All opinions are my own.
  Warren   v\ *|     ----------------------------------------------
             V       {uunet,sun}!convex!swarren; swarren@convex.COM