POV-Ray : Newsgroups : povray.advanced-users : Bounding Question Server Time
30 Jul 2024 18:14:37 EDT (-0400)
  Bounding Question (Message 1 to 10 of 17)  
Goto Latest 10 Messages Next 7 Messages >>>
From: Ken
Subject: Bounding Question
Date: 10 Aug 1999 21:48:51
Message: <37B0D63D.79B25D6@pacbell.net>
Greetings Advanced Users !

  I have a scene rendering that has been going now for 24 hours. It has
several levels of recursion and has deeply nested CSG operations. To
decrease the rendering time I added manual bounding to the differencing
objects. This gave me a decent increase of rendering time at 1 level of
recursion when I was testing to see if manual bounding would help.

  However since I bumped the recursion level up to a depth of 5 my
render time has decreased to a point of being unacceptable and I am
likely to stop my current session and just give up on it. I calculate
at it's current rendering rate of 4 hours per line with 412 lines to
go it will take 69 days to finish. My question then is should I turn
automatic bounding off when manual bounding has been used in the scene
file or will the manual bounding simply override any automatic bounding
that would normally occur ?

  In my current bounding scheme I have the objects that are subtracting
from the original shape bounded individually and I have also bounded the
shape that is being differenced. Another question would be is when to bound
a shape in an operation for optimum performance. There are often several
ways of adding bounding and I am not sure when or where it should be
applied. Will manual bounding at the wrong place hurt the process when
a certain number of csg operations if reached as opposed to being an aid
in a simple operation ?
 I would be more than happy to post the source for anyone willing to look
at it but it is a bit lengthy to add to this post without first seeing an
interest in it.

A skeleton example of the bounding scheme I am currently using is:

// the cutting objects
#declare Diff_shape =

intersection {
      object { obj1 }
      object { obj2 }
  bounded_by {
      object { obj3 }
             }
// bound the cutting shape
#declare Diff_Shape_bound = object { Diff_Shape }

// The shape being cut
#declare Diff_Obj = object { obj4 }

// A bounding shape for the shape being cut
#declare Diff_Obj_Bound = object { Diff_Obj }

Then I have a complicated recursive while loop to difference the Diff_obj.

// The differencing operation
#declare Final_Shape =
difference {
Loop stuff
    object { Diff_Obj }
     union {
    object { Diff_Shape }
bounded_by {
    object { Diff_Shape_bound }
           }
#end loop stuff      }

// And finaly bound the entire object after the difference operation.
    object { Final_Shape
bounded_by {
    object { Diff_Obj_Bound }
           }

Is this complicating things overly much ? It really seemed to help when I used
lower recursion depths but when going higher it has basicaly stalled out.

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Ken
Subject: Re: Bounding Question
Date: 10 Aug 1999 22:16:29
Message: <37B0DCB8.663A1A02@pacbell.net>
Ken wrote:

> // The differencing operation
> #declare Final_Shape =
> difference {
> Loop stuff
>     object { Diff_Obj }
>      union {
>     object { Diff_Shape }
> bounded_by {
>     object { Diff_Shape_bound }
>            }
> #end loop stuff      }

Append the above to be:

 #declare Final_Shape =
 difference {
 Loop stuff
     object { Diff_Obj }
     object { Diff_Shape
 bounded_by {
     object { Diff_Shape_bound }
            }
            }
 #end loop stuff      }

The union was not necessary and I made a mistake in using the bounding object.

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Nieminen Mika
Subject: Re: Bounding Question
Date: 11 Aug 1999 03:14:30
Message: <37b122d6@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
:  #declare Final_Shape =
:  difference {
:  Loop stuff
:      object { Diff_Obj }
:      object { Diff_Shape
:  bounded_by {
:      object { Diff_Shape_bound }
:             }
:             }
:  #end loop stuff      }

  Sorry for whining about indentation again, but here we have an excellent
example of a very simple structure where it's very difficult to see what
the bounding object is bounding. Is it bounding the difference? Or the second
object? I had to watch the code several minutes before I saw it.

  Note: I'm not saying that you should change your indentation style. I just
liked this example.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nieminen Mika
Subject: Re: Bounding Question
Date: 11 Aug 1999 03:29:20
Message: <37b12650@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: My question then is should I turn
: automatic bounding off when manual bounding has been used in the scene
: file or will the manual bounding simply override any automatic bounding
: that would normally occur ?

  I have always understood, that manual bounding overrides the automatic
bounding of the object you are bounding (of course when removing
"unnecesary" bounding objects is turned off).
  I really don't know what happens with complex CSG objects. I have
the feeling that CSG's have several bounding objects, one for the whole
CSG and several smaller for the different parts (I may be wrong here, though).
If this is the case and you manually bound the whole CSG I don't know what
happens to the smaller bounding objects.
  I can't imagine why turning automatic bounding off would speed up the
rendering. I think that the manual bound overrides the automatic one, it's
not added to the automatically generated bounding object.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ken
Subject: Re: Bounding Question
Date: 11 Aug 1999 05:05:29
Message: <37B13C91.54E5E730@pacbell.net>
Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> :  #declare Final_Shape =
> :  difference {
> :  Loop stuff
> :      object { Diff_Obj }
> :      object { Diff_Shape
> :  bounded_by {
> :      object { Diff_Shape_bound }
> :             }
> :             }
> :  #end loop stuff      }
> 
>   Sorry for whining about indentation again, but here we have an excellent
> example of a very simple structure where it's very difficult to see what
> the bounding object is bounding. Is it bounding the difference? Or the second
> object? I had to watch the code several minutes before I saw it.
> 
>   Note: I'm not saying that you should change your indentation style. I just
> liked this example.

  When scripting for my own use it would more likely have looked like this:

  #declare Final_Shape =
  difference {
  #Loop stuff
      object { Diff_Obj }
      object { Diff_Shape bounded_by{object{Diff_Shape_bound}}}
  #end }


-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Ken
Subject: Re: Bounding Question
Date: 11 Aug 1999 05:17:39
Message: <37B13F6D.88F860F6@pacbell.net>
Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> : My question then is should I turn
> : automatic bounding off when manual bounding has been used in the scene
> : file or will the manual bounding simply override any automatic bounding
> : that would normally occur ?
> 
>   I have always understood, that manual bounding overrides the automatic
> bounding of the object you are bounding (of course when removing
> "unnecesary" bounding objects is turned off).
>   I really don't know what happens with complex CSG objects. I have
> the feeling that CSG's have several bounding objects, one for the whole
> CSG and several smaller for the different parts (I may be wrong here, though).
> If this is the case and you manually bound the whole CSG I don't know what
> happens to the smaller bounding objects.
>   I can't imagine why turning automatic bounding off would speed up the
> rendering. I think that the manual bound overrides the automatic one, it's
> not added to the automatically generated bounding object.

That is pretty much what I had thought too. It is frustrating trying to
render what should be a fairly strait forward csg operation only to find
it is going to take longer than a reasonable amount of time to finish. In
the last 30 hrs. I can hardly tell that there has been any progress at all.
According to my system monitoring software I am using 100% of my processor
power for this task and nothing is happening that I can see. I imagine the
time is being consumed by intersection testing and if I were to let this
render finish the intersection tests will number in the billions or even
tens of billions. There has to be a way to cut this down since there is such
a small amount of visible object surface area actually being rendered and
the rest is being wasted on internal intersection tests that are not even
visible. I was under the impression that this is what manual or automatic
bounding was supposed to help out with.

Oh well only 1652 hours more to go before it is finished...

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Ken
Subject: Re: Bounding Question
Date: 11 Aug 1999 05:55:16
Message: <37B1483E.4398B64B@pacbell.net>
Nieminen Mika wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> :  #declare Final_Shape =
> :  difference {
> :  Loop stuff
> :      object { Diff_Obj }
> :      object { Diff_Shape
> :  bounded_by {
> :      object { Diff_Shape_bound }
> :             }
> :             }
> :  #end loop stuff      }
> 
>   Sorry for whining about indentation again, but here we have an excellent
> example of a very simple structure where it's very difficult to see what
> the bounding object is bounding. Is it bounding the difference? Or the second
> object? I had to watch the code several minutes before I saw it.
> 
>   Note: I'm not saying that you should change your indentation style. I just
> liked this example.

Here you go Warp. The software at this site will allow you to automaticaly
reformat my badly indented code into an indented format of your choice :)

http://www.ralgi.com/products/products.html#VSF

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Gilles Tran
Subject: Re: Bounding Question
Date: 11 Aug 1999 09:32:13
Message: <37B17BF8.7198092C@inapg.inra.fr>
No solution for the bounding problem but here is another approch : could you
prevent the apparition of unecessary (invisible) objects (on the basis of their
position in space for instance) ? I've done this a couple of times (for my madpipe
macro for instance) and it can cut down drastically your number of objects. Of
course it may not be feasible in your case.
Another solution I'm using a lot these days is to export systematically
procedure-generated objects like this to an inc file so that I can play with them
without having to parse things again and again. Also,  I can remove objects
directly from the inc file. With a recursion macro, you could store each recursion
level objects in their own file.

Gilles Tran

Ken wrote:

> Greetings Advanced Users !
>
>   I have a scene rendering that has been going now for 24 hours. It has
> several levels of recursion and has deeply nested CSG operations. To
> decrease the rendering time I added manual bounding to the differencing
> objects. This gave me a decent increase of rendering time at 1 level of
> recursion when I was testing to see if manual bounding would help.
>
>   However since I bumped the recursion level up to a depth of 5 my
> render time has decreased to a point of being unacceptable and I am
> likely to stop my current session and just give up on it. I calculate
> at it's current rendering rate of 4 hours per line with 412 lines to
> go it will take 69 days to finish. My question then is should I turn
> automatic bounding off when manual bounding has been used in the scene
> file or will the manual bounding simply override any automatic bounding
> that would normally occur ?
>
>   In my current bounding scheme I have the objects that are subtracting
> from the original shape bounded individually and I have also bounded the
> shape that is being differenced. Another question would be is when to bound
> a shape in an operation for optimum performance. There are often several
> ways of adding bounding and I am not sure when or where it should be
> applied. Will manual bounding at the wrong place hurt the process when
> a certain number of csg operations if reached as opposed to being an aid
> in a simple operation ?
>  I would be more than happy to post the source for anyone willing to look
> at it but it is a bit lengthy to add to this post without first seeing an
> interest in it.
>
> A skeleton example of the bounding scheme I am currently using is:
>
> // the cutting objects
> #declare Diff_shape =
>
> intersection {
>       object { obj1 }
>       object { obj2 }
>   bounded_by {
>       object { obj3 }
>              }
> // bound the cutting shape
> #declare Diff_Shape_bound = object { Diff_Shape }
>
> // The shape being cut
> #declare Diff_Obj = object { obj4 }
>
> // A bounding shape for the shape being cut
> #declare Diff_Obj_Bound = object { Diff_Obj }
>
> Then I have a complicated recursive while loop to difference the Diff_obj.
>
> // The differencing operation
> #declare Final_Shape =
> difference {
> Loop stuff
>     object { Diff_Obj }
>      union {
>     object { Diff_Shape }
> bounded_by {
>     object { Diff_Shape_bound }
>            }
> #end loop stuff      }
>
> // And finaly bound the entire object after the difference operation.
>     object { Final_Shape
> bounded_by {
>     object { Diff_Obj_Bound }
>            }
>
> Is this complicating things overly much ? It really seemed to help when I used
> lower recursion depths but when going higher it has basicaly stalled out.
>
> --
> Ken Tyler
>
> See my 700+ Povray and 3D Rendering and Raytracing Links at:
> http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Dave Kreskowiak
Subject: Re: Bounding Question
Date: 11 Aug 1999 11:36:11
Message: <37b1986b@news.povray.org>
Hi all.  I took a quick look at the code fragments here and have wondered if
anyone has seen the same thing I have.

In the code, it appears that there is a bounding object for just about every
single difference object.  On top of that, what does the bounding object
consist of?  A simple box, sphere or something more complex?  I guess it
would help to see the actual code.  But the thought I have is it looks like
there is about as many bounding objects as there are primitives.  If this is
the case, here goes:

In the case of bounding, more bounds is not a good thing.  If your checking
a high number of bounding objects, the speed difference, between that and
just checking if you've hit the object itself, is lost.  I had a similar
problem with a simple lamp (a small part of the scene is attached).  It's
not a recursive object by any means, but it's simply a cone shape cut with
another cone offset and then about 210 long boxes to cut out ribs.  The
texture is 95% transparent with an IOR about 1.25.  The only light source in
the scene is in the lamp.  Cutting the shapes into the lamp shade drove the
rendering time up from 4 hours to about 21 days!

What I found in my case was this (I THINK my analysis is right, if not say
so!! ;)  CSG's are automatically bounded by POV by default. This meant that
whenever a ray hit the bounding box the ray would be checked against every
primitive inside the box. In my case that's 212 objects, plus an IOR.  This
meant that I had to come up with a better bounding scheme.

Putting a bounding object around every box that cut a rib would not
eliminate the problem because it would just be checking 210 bounding boxes.
No speed gain there.  The solution was to:

        - Turn off POV's automatic bounding.
        - NOT bound the entire shade in a box
                there is a light in it and all rays will hit it anyway!
        - Group a bunch of adjacent ribs together with a union and then
bound that union with a box.

In my lamp there are 210 ribs in 10 groups of 21.  This way a ray will be
checked against a maximum of 10 bounding boxes and then a maximum of 23
primitives (not counting IOR of course!)  The tracing time went from 21 to
5.5 days.

Dave

Ken <tyl### [at] pacbellnet> wrote in message
news:37B### [at] pacbellnet...
>
> Greetings Advanced Users !
>
>   I have a scene rendering that has been going now for 24 hours. It has
> several levels of recursion and has deeply nested CSG operations. To
> decrease the rendering time I added manual bounding to the differencing
> objects. This gave me a decent increase of rendering time at 1 level of
> recursion when I was testing to see if manual bounding would help.


Post a reply to this message


Attachments:
Download 'Lamp.jpg' (14 KB)

Preview of image 'Lamp.jpg'
Lamp.jpg


 

From: Nieminen Mika
Subject: Re: Bounding Question
Date: 11 Aug 1999 13:17:14
Message: <37b1b01a@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
: Here you go Warp. The software at this site will allow you to automaticaly
: reformat my badly indented code into an indented format of your choice :)

  Actually your indentation style reflects your personality. I think it
would be insulting to modify your expressive talent. I would be seeing
a fake Ken.
  Keep up with your own style. If I whine sometimes, don't let it bother
you :)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

Goto Latest 10 Messages Next 7 Messages >>>

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