POV-Ray : Newsgroups : povray.general : Rendering recursive objects (Menger Sponge) : Re: Rendering recursive objects (Menger Sponge) Server Time
29 Jul 2024 10:18:16 EDT (-0400)
  Re: Rendering recursive objects (Menger Sponge)  
From: [GDS|Entropy]
Date: 8 Nov 2011 06:50:01
Message: <web.4eb9170d5836d2f477e50e540@news.povray.org>
"Terabyte" <nomail@nomail> wrote:
> Hello,
>
> I'm kinda new here, but not new to Pov-Ray.
>
> I'm interested in rendering a menger scene, but up until now I'm stuck by at a
> Menger Sponge of level 7.
>
> Level 0 to Level 6 together in one scene so far is no problem (takes 1 Gig of
> RAM, and 1,5 hour to render a 3200x2400 AA 0.3 scene, with shiny floor and
> texture), but at level 7 I keep getting Out Of Memory errors.

When I work with recursive objects I run into this same issue. Given the number
of objects you are dealing with, there will always be a ceiling at relatively
low iteration counts, but there are a few ways to increase this a bit.

> So my question is: Since Menger Sponges are recursive (in fact it's only one
> single cube, copied millions of times), is there a possibility, to save RAM by
> "telling" Pov-Ray to use the same object over and over again, instead of
> creating different copies of the same cube?

Are you currently are creating new cubes within your loop, or #declaring a cube
and translate/scaling it?

Here are a few ideas that might help you get to a higher ceiling [some may be
better than others]:
1) Use mesh instead of cube
2) Use backface/hidden object culling
4) Alter your method to be non-recursive [this works in c# when stack size is
the issue, but may not have great effect in SDL..I'm not sure]
5) Export data to a file, them perform operations on that file [such as #2], or
use it as a "save point", so you can calculate iterations 1-6 and dump to file,
then on a second run, start the loop at 6 and go to N.
6) Some combination of 1-5, or all of them.

Which of these may be better for you depends on how pov allocates memory for a
given task/object.

Sadly, I am not yet familiar enough with pov memory allocation to provide a
better answer or narrow my suggestions down, and thus must defer to one of our
many other fine members here for such information.

Hopefully you at least have some useful ideas now.

Ian


Post a reply to this message

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