|
![](/i/fill.gif) |
Wasn't it Dave Matthews who wrote:
>
>I know why differencing with a union is so slow, but I was wondering
>
>A) Why is differencing with a blob so much faster?
>
>B) (Depending on the answer to A) Would it be possible to use whatever
>bounding improvements cause the blob difference to be faster to improve
>the CSG difference? (Since I don't know jack about programming, this is
>probably a stupid question that is almost impossible to answer at a
>level I could understand, but I still have to ask it.)
>
>C) Any idea why the intersection with a blob full of holes (3rd
>example) should be faster than differencing with a positive blob (2nd
>example)? Or is it purely an accident of the scenes I happened to choose?
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.
(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.
(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.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |