POV-Ray : Newsgroups : povray.general : Differences with Large Unions : Differences with Large Unions Server Time
8 Aug 2024 04:06:03 EDT (-0400)
  Differences with Large Unions  
From: Geoff Wedig
Date: 13 Mar 2001 07:49:54
Message: <3aae1772@news.povray.org>
I have a union of many small, mostly disjoint objects, and now I need to do
a difference with them.  From past experience, when I do an intersection
with such a conglomeration, it turns it into a single large object that is
only bounded at the largest extent, and slows down the render a lot.  I may
not have the above correct, but it certainly slows the render down a lot.

Since the section I have to cut out is small, and doesn't intersect most of
the objects, I'm wondering if there might be a better way.  I'm thinking
doing a check to see if each individual object intersects the cutout, and if
so, do a difference with it.  Otherwise, don't.  Take the union of all that. 
Most of the objects would not be affected.

The only problem is how to determine if the cutout and the union object
intersect.  Does anyone have any ideas how to do this?  Can we access the
bounding boxes POV generates?  That would probably be ideal, since it's
trivial to check if two boxes intersect, but is there another, faster way to
do this (I'm somewhat concerned about trading the parse time for render
time, though in this case, parse time will be cheap comparatively)

Also, has anyone considered automating such an algorithm?  It seems to me
that POV could, when seeing code like:

difference
{
  union
  {
    smallobject1
    smallobject2
    smallobject3
    smallobject4
    .
    .
    .
    smallobjectn
  }
  anotherobject
}

it could turn it into:

union
{
  difference { smallobject1 anotherobject }
  smallobject2
  smallobject3
  smallobject4
}

assuming that only smo1 intersected ano's bounding box.  I would think this
would speed things up.  Could work for intersections too.  Of course, some
heuristics would need to be generated to determine when to do the level
swapping, and I have no idea how to do that.

Geoff


Post a reply to this message

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