POV-Ray : Newsgroups : povray.general : why are differences soooo slow? : Re: why are differences soooo slow? Server Time
11 Aug 2024 23:23:08 EDT (-0400)
  Re: why are differences soooo slow?  
From: Ron Parker
Date: 27 Apr 1999 11:46:23
Message: <3725cdbf.0@news.povray.org>
On Tue, 27 Apr 1999 10:10:34 +0900, Rainer Mager wrote:
>    So, my hopothysis is this...on the second case, as soon as the box or
>black cylinder objects are found by a cast ray, the ray is ended and the
>pixel is plotted. In the first case, when a ray enters a hole it must check
>and recheck many times for other objects as it passes through the hole,
>hence the higher stats and the slower render.

Actually, I believe you have it backwards.  Here's what happens:

A ray is shot at the difference object.  It hits a face of the object.
Chances are this is a face of the box, or possibly the end of one of 
the cylinders.  To find this intersection, POV asks every sub-object
of the object to return all intersections of the ray with that sub-object,
then picks the closest one.

POV now must check this intersection to make sure that it is inside the 
box and outside of every cylinder before it is considered a valid hit.  
If it isn't valid (i.e. it's inside one of the cylinders, or it's not 
inside the box) then it gets ignored and we go on to the next-closest 
intersection.  When we finally find a valid intersection, we calculate 
its color and return that as the value for the ray (keeping in mind 
that the shadow calculation for each light source used to calculate 
the color is also a ray and performs the same operation.)  

So, when a ray hits the object you're building, POV first needs to ask 
201 objects to calculate their intersections, then needs to test one or 
more hits against 200 objects to determine if they're valid, then needs 
to do the same thing again for each light source in the scene to calculate 
shadows. In your scene, with one light source, this comes out to at least 
402 hit tests and either 200 or 400 insideness tests (depending on whether
the hit might be in a shadow) for each ray that hits your object.  Bounding 
helps this a lot, clearly, but it's also likely that the bounding structures 
in a CSG could be improved at the source level.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.