POV-Ray : Newsgroups : povray.general : CSG difference v. Blob difference v. Negative Blob : Re: CSG difference v. Blob difference v. Negative Blob Server Time
2 Aug 2024 08:14:12 EDT (-0400)
  Re: CSG difference v. Blob difference v. Negative Blob  
From: Dave Matthews
Date: 7 Dec 2004 08:53:38
Message: <41b5b5e2$1@news.povray.org>
Mike Williams wrote:

> You can get some clues about what's going on by using the techniques I
> used on my holes tutorial. Take a look at the Rendering Statistics
> produced using different techniques. Here's the stats from scenes which
> produce 2001 spherical holes in a box. I used no_shadow to avoid the
> calculation of shadow rays, which caused small differences in the
> numbers of rays cast in the different scenes. 
> 
> PURE CSG DIFFERENCE
> 
> Ray->Shape Intersection          Tests       Succeeded  Percentage
> Box                              19200            8901     46.36
> CSG Intersection                 38400           27933     72.74
> Sphere                        38419200           88971      0.23
> 
> DIFFERENCE WITH POSITIVE BLOB
> 
> Ray->Shape Intersection          Tests       Succeeded  Percentage
> Blob                             19200            8130     42.34
> Blob Component                   69771           69771    100.00
> Blob Bound                     1691140          324316     19.18
> Box                              19200            8901     46.36
> CSG Intersection                 19200            8835     46.02
> 
> INTERSECTION WITH NEGATIVE BLOB
> 
> Ray->Shape Intersection          Tests       Succeeded  Percentage
> Blob                             19200           18056     94.04
> Blob Component                   88971           88971    100.00
> Blob Bound                     1786832          440132     24.63
> Box                              19200            8901     46.36
> CSG Intersection                 19200            8853     46.11
> 
> I rendered a small image 160*120, so there were 19200 pixels, and since
> there are no shadows, there are 19200 rays. In the pure CSG scene each
> of those 19200 rays are tested against one box and 2001 spheres,
> resulting in over 39 million tests being calculated. No bounding tests
> occur.
> 
> In the case of the blobs, what seems to be happening is that blob
> bounding does take place. It looks like the blob is calculated with the
> benefits that that entails, and afterwards the CSG is performed without
> ordinary bounding.

That makes sense.  Thanks.  I still have a tough time puzzling out those 
stats.  Guess I'll have to study up on them more.

> (B) I guess that it would be possible for POV to be modified to use the
> same sort of trick with pure CSG differences, and thereby achieve even
> greater speeds in these circumstances (because CSG cylinder and sphere
> tests are faster than blob tests). It might be difficult for POV to
> automatically determine when to use the trick, so it might be necessary
> to have some syntax for specifying when bounds should be calculated for
> a subset of a CSG object before performing the overall CSG operation.

My thinking was that it's faster to do ordinary sphere and cylinder 
tests, but now that you point it out, I guess POVRay would have to know 
when to think of the union as some sort of megaSphereCylinder object 
(perhaps we could call it a "Blob" -- never mind), and adding yet one 
more user option -- well, I don't even know half the ones we already 
have. But this situation is common enough that it might be useful.

> (C) On my machine, your positive and negative blob code examples ran at
> exactly the same speed. Perhaps your machine happened to be doing
> something else when the positive blob code was running, or perhaps you
> happened to look at the PPS numbers at different stages of the render.
> The Render Statistics are so similar that I can't believe that there can
> have been a real effect. The difference in the stats is caused by the
> fact that there's one extra large component in the negative blob which
> needs to be calculated, so the negative blob should be slightly slower.
> 

I would have thought so, too, but several more complicated complete 
scenes, using AA and shadows and such produced some marked differences. 
  If I can produce a simple example, I'll post up the summary stats, and 
maybe we (you) can make sense of them.

Thanks again for all your help.

BTW, I have several students (finally) whom I've gotten interested in 
POVRay, and pointed them to your site, after they get the basics from 
Fredrich Lohmueller's tutorial.  They think yours is a fantastic 
tutorial (much clearer than my explanations, as one of them said. . . .) 
   Those who have had, or are taking, multi-variable calculus really 
appreciate your treatment of isosurfaces.  (And so do I!) None are far 
enough along for POVComp 2004, but, given that some have actual artistic 
talent, and all of them have programming experience, they'll probably 
pass me up by the end of Christmas break.

Dave Matthews


Post a reply to this message

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