POV-Ray : Newsgroups : povray.general : Rendering recursive objects (Menger Sponge) : Re: Rendering recursive objects (Menger Sponge) Server Time
29 Jul 2024 10:30:43 EDT (-0400)
  Re: Rendering recursive objects (Menger Sponge)  
From: Paul Fuller
Date: 9 Nov 2011 01:14:49
Message: <4eba1a59@news.povray.org>
On 8/11/2011 8:40 PM, Terabyte wrote:
> 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.
>
> 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?

For a Menger Sponge, each level of recursion increases the number of 
cubes by 20x.  So by level 7 (if level 0 is 1 cube) you would be 
specifying 20^7 cubes or 1.28 billion cubes.  Even though the cubes are 
simple, each one has to be located in 3D space and may even have 
associated texture info etc.

Given the nature of ray tracing, each of these has to be in existence. 
Note that bounding boxes may not need each ray to be tested against each 
object but in any case they are represented as objects in memory.

Even instancing a cube as a mesh will still result in 1.28 billion 
instances as I understand it.

The isosurface approach suggested by Christian may be your only hope.  I 
dn't know about that.

Now, at the deepest level are the cubes still visible ?  If the starting 
cube was 1000 pixels on a side then at level 7 the cubes would be 1000 / 
3^7 = 1000 / 2187 or about half a pixel in size.  I guess you'd get some 
impression of detail given AA.  More so of course at your stated 
resolution of 3200x2400 and if the view is zoomed in somewhat.

Good luck and do post the result at reduced resolution.


Post a reply to this message

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