POV-Ray : Newsgroups : povray.general : Speeding up rendering many spheres : Re: Speeding up rendering many spheres Server Time
19 Apr 2024 07:39:16 EDT (-0400)
  Re: Speeding up rendering many spheres  
From: Nicolas George
Date: 6 May 2020 14:44:15
Message: <5eb3057f$1@news.povray.org>

> I shall test, but it would be helpful to know what is supposed to be the
> result.

I ran the test, with the scene below.

My conclusion is that POV-Ray does not try to compute bounding boxes for
components of a CSG object.

Can somebody confirm it is the expected behavior?

Well, that means I should gain a significant speed improvement by computing
intermediate bounding boxes before rendering.

As a side note: maybe a directive auto_bounding_box would be a good idea to
let the scene author hint POV-Ray: "this is a very complex CSG object, but
this part is small, it deserves its own bounding box".

Thanks for your help.


My test scene:

camera { 
  location <0, 0, -2>
  look_at <0, 0, 0>
}

#macro many_spheres(x0, y0, z0)
  #local i = -10;
  #while (i <= 10)
    #local j = -10;
    #while (j <= 10)
      #local k = -10;
      #while (k <= 10)
        sphere { <x0 + 0.001 * i, y0 + 0.001 * j, z0 + 0.001 * k>, 0.0008 }
        #local k = k + 1;
      #end
      #local j = j + 1; 
    #end
    #local i = i + 1;
  #end
#end
    
merge {
  //merge {
    many_spheres(-0.5, 0.5, 0)
    //bounded_by { box { <-0.52, 0.48, -0.02>, <-0.48, 0.52, 0.02> } }
  //}
  //merge {
    many_spheres(0.5, -0.5, 0)
    //bounded_by { box { <0.48, -0.52, -0.02>, <0.52, -0.48, 0.02> } }
  //}
  pigment { rgb <1, 1, 0> }
  finish { ambient 1 }
}   

// with bounded_by:  using 8 thread(s) with 3.698 CPU-seconds total
// without:          using 8 thread(s) with 137.005 CPU-seconds total
// without submerge: using 8 thread(s) with 136.182 CPU-seconds total


Post a reply to this message

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