POV-Ray : Newsgroups : povray.general : Help with a slow difference : Re: Help with a slow difference Server Time
2 Aug 2024 00:15:29 EDT (-0400)
  Re: Help with a slow difference  
From: Mike Williams
Date: 1 Mar 2005 01:13:40
Message: <dHlUOIAMeAJCFw4y@econym.demon.co.uk>
Wasn't it Alf Peake who wrote:
>Any suggestions how to make the last two tests below render faster?
>And why the difference in times?
>
>Mat is a union of 240 rounded triangles (each 7 objects) on the
>y-plane. I want to cut out a circular section for a table-top.
>
>All tests +w512 +h384 +a0.3, and include
>torus{ 3,0.05 translate <3.5,0,3.5> pigment{ rgb <0,1,1> } }
>
>// Total time: 5s - 39424PPS.
>object{Mat}
>
>// Time: 9m 11s - 357PPS.
>// Rr is the triangle rounding radius.
>object{ Mat
>   clipped_by{
>      cylinder{ <3.5,-Rr*1.05, 3.5>, <3.5, Rr*1.05, 3.5>, 3 } }
>   bounded_by{
>      cylinder{ <3.5,-Rr*1.1, 3.5>, <3.5, Rr*1.1, 3.5>, 3.01 } }
>}
>
>// Time: 12m 27s - 263PPS.
>difference{
>   object{ Mat }
>   cylinder{ <3.5,-Rr*1.05, 3.5>, <3.5, Rr*1.05, 3.5>, 3 inverse }
>   bounded_by{
>      cylinder{ <3.5,-Rr*1.1, 3.5>, <3.5, Rr*1.1, 3.5>, 3.01 } }
>}
>
>The last render can be seen here:
>http://www.qsl.net/gw3srg/bits/tabletop.jpg
>

It will go a lot faster if you change it from a difference of unions to
a union of differences. This might seem to be counterintuitive because
there will then be 240 difference operations instead of just one, but it
allows POV to create a bounding slab for each triangle instead of one
big bounding slab for the whole tabletop.

union {
  difference {
    object {Rounded_Triangle_1}
    cylinder{ <3.5,-Rr*1.05, 3.5>, <3.5, Rr*1.05, 3.5>, 3 inverse }
  }
  difference {
    object {Rounded_Triangle_2}
    cylinder{ <3.5,-Rr*1.05, 3.5>, <3.5, Rr*1.05, 3.5>, 3 inverse }
  }
  ... etc
}

(Presumably you create the Mat with some sort of loop, so just code teh
difference operations into that loop)

Don't apply manual bounding to the union of differences.

For more details of the logic behind this sort of stuff, see:

<http://www.econym.demon.co.uk/holetut/index.htm>


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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