POV-Ray : Newsgroups : povray.windows : Can anyone parse this correctly? Server Time
18 May 2024 14:42:30 EDT (-0400)
  Can anyone parse this correctly? (Message 1 to 5 of 5)  
From: FractalMBrown
Subject: Can anyone parse this correctly?
Date: 19 Jul 2005 11:45:01
Message: <web.42dd1fe9e652faa392a4d1390@news.povray.org>
I am attempting to render a 1600x1200 AA 0.3 version of a level 5 Menger
Sponge. However, it will crash with a "POV-Ray for Windows has encountered
an error" message after about two minutes, occasionally. And, when it does
appear to parse correctly, there is no render window and the statistics say
that the entire four minutes was spent on render time. I check the folder
and find a 640x480 bitmap file, which is not what I wanted. It will also
crash for me if I try 800x600 no AA. I run Windows XP Home with POV-Ray
3.6.

//BEGIN POV FILE

//The method I'm using to do this is this: create a 3x3 block of cubes, then
comment out
//the appropriate cubes to remove. This creates the Menger Sponge. Most of
this POV file
//is just a bunch of declarations, and in the end, there will only be about
one object.

#include "colors.inc"

global_settings {
  radiosity {
    pretrace_start 0.08
    pretrace_end   0.04
    count 35
    nearest_count 5
    error_bound 1.8
    recursion_limit 3
    low_error_factor .5
    gray_threshold 0.0
    minimum_reuse 0.015
    brightness 1

    adc_bailout 0.01/2
     }
   }


  background { White * .86 }

camera {
  location  <1.0, 2.0, -5.0>
  look_at   <-0.3, -0.3333,  0.0>
  rotate    <0.0, clock*360, 0.0>
  right     x*image_width/image_height
}

  //This is the section where all the cubes are declared.

  #declare s1 = 0.8;
  #declare s2 = 0.9;
  #declare s3 = 0.9;
  #declare s4 = 0.9;
  #declare s5 = 0.9;

  #declare obj1 =
     box { <-.5, -.5, -.5> <.5, .5, .5> //This is a 1x1 cube.


                material {
                  texture  {
                    pigment  {   White   }
                    finish   { diffuse .5 ambient 0 specular .5 }
                           }
                         }
         }


   #declare lev1 = union {

        object { obj1 scale s1 translate <1, 1, 1> }
        object { obj1 scale s1 translate <2, 1, 1> }
        object { obj1 scale s1 translate <3, 1, 1> }
        object { obj1 scale s1 translate <1, 2, 1> }
   //   object { obj1 scale s1 translate <2, 2, 1> }
        object { obj1 scale s1 translate <3, 2, 1> }
        object { obj1 scale s1 translate <1, 3, 1> }
        object { obj1 scale s1 translate <2, 3, 1> }
        object { obj1 scale s1 translate <3, 3, 1> }

        object { obj1 scale s1 translate <1, 1, 2> }
   //   object { obj1 scale s1 translate <2, 1, 2> }
        object { obj1 scale s1 translate <3, 1, 2> }
   //   object { obj1 scale s1 translate <1, 2, 2> }
   //   object { obj1 scale s1 translate <2, 2, 2> }
   //   object { obj1 scale s1 translate <3, 2, 2> }
        object { obj1 scale s1 translate <1, 3, 2> }
   //   object { obj1 scale s1 translate <2, 3, 2> }
        object { obj1 scale s1 translate <3, 3, 2> }

        object { obj1 scale s1 translate <1, 1, 3> }
        object { obj1 scale s1 translate <2, 1, 3> }
        object { obj1 scale s1 translate <3, 1, 3> }
        object { obj1 scale s1 translate <1, 2, 3> }
   //   object { obj1 scale s1 translate <2, 2, 3> }
        object { obj1 scale s1 translate <3, 2, 3> }
        object { obj1 scale s1 translate <1, 3, 3> }
        object { obj1 scale s1 translate <2, 3, 3> }
        object { obj1 scale s1 translate <3, 3, 3> }

        translate <-2, -2, -2>

        scale 1/3

        }

    #declare lev2 = union {

        object { lev1 scale s2 translate <1, 1, 1> }
        object { lev1 scale s2 translate <2, 1, 1> }
        object { lev1 scale s2 translate <3, 1, 1> }
        object { lev1 scale s2 translate <1, 2, 1> }
   //   object { lev1 scale s2 translate <2, 2, 1> }
        object { lev1 scale s2 translate <3, 2, 1> }
        object { lev1 scale s2 translate <1, 3, 1> }
        object { lev1 scale s2 translate <2, 3, 1> }
        object { lev1 scale s2 translate <3, 3, 1> }

        object { lev1 scale s2 translate <1, 1, 2> }
   //   object { lev1 scale s2 translate <2, 1, 2> }
        object { lev1 scale s2 translate <3, 1, 2> }
   //   object { lev1 scale s2 translate <1, 2, 2> }
   //   object { lev1 scale s2 translate <2, 2, 2> }
   //   object { lev1 scale s2 translate <3, 2, 2> }
        object { lev1 scale s2 translate <1, 3, 2> }
   //   object { lev1 scale s2 translate <2, 3, 2> }
        object { lev1 scale s2 translate <3, 3, 2> }

        object { lev1 scale s2 translate <1, 1, 3> }
        object { lev1 scale s2 translate <2, 1, 3> }
        object { lev1 scale s2 translate <3, 1, 3> }
        object { lev1 scale s2 translate <1, 2, 3> }
   //   object { lev1 scale s2 translate <2, 2, 3> }
        object { lev1 scale s2 translate <3, 2, 3> }
        object { lev1 scale s2 translate <1, 3, 3> }
        object { lev1 scale s2 translate <2, 3, 3> }
        object { lev1 scale s2 translate <3, 3, 3> }

        translate <-2, -2, -2>

        scale 1/3

        }

    #declare lev3 = union {

        object { lev2 scale s3 translate <1, 1, 1> }
        object { lev2 scale s3 translate <2, 1, 1> }
        object { lev2 scale s3 translate <3, 1, 1> }
        object { lev2 scale s3 translate <1, 2, 1> }
   //   object { lev2 scale s3 translate <2, 2, 1> }
        object { lev2 scale s3 translate <3, 2, 1> }
        object { lev2 scale s3 translate <1, 3, 1> }
        object { lev2 scale s3 translate <2, 3, 1> }
        object { lev2 scale s3 translate <3, 3, 1> }

        object { lev2 scale s3 translate <1, 1, 2> }
   //   object { lev2 scale s3 translate <2, 1, 2> }
        object { lev2 scale s3 translate <3, 1, 2> }
   //   object { lev2 scale s3 translate <1, 2, 2> }
   //   object { lev2 scale s3 translate <2, 2, 2> }
   //   object { lev2 scale s3 translate <3, 2, 2> }
        object { lev2 scale s3 translate <1, 3, 2> }
   //   object { lev2 scale s3 translate <2, 3, 2> }
        object { lev2 scale s3 translate <3, 3, 2> }

        object { lev2 scale s3 translate <1, 1, 3> }
        object { lev2 scale s3 translate <2, 1, 3> }
        object { lev2 scale s3 translate <3, 1, 3> }
        object { lev2 scale s3 translate <1, 2, 3> }
   //   object { lev2 scale s3 translate <2, 2, 3> }
        object { lev2 scale s3 translate <3, 2, 3> }
        object { lev2 scale s3 translate <1, 3, 3> }
        object { lev2 scale s3 translate <2, 3, 3> }
        object { lev2 scale s3 translate <3, 3, 3> }

        translate <-2, -2, -2>

        scale 1/3

        }

    #declare lev4 = union {

        object { lev3 scale s4 translate <1, 1, 1> }
        object { lev3 scale s4 translate <2, 1, 1> }
        object { lev3 scale s4 translate <3, 1, 1> }
        object { lev3 scale s4 translate <1, 2, 1> }
   //   object { lev3 scale s4 translate <2, 2, 1> }
        object { lev3 scale s4 translate <3, 2, 1> }
        object { lev3 scale s4 translate <1, 3, 1> }
        object { lev3 scale s4 translate <2, 3, 1> }
        object { lev3 scale s4 translate <3, 3, 1> }

        object { lev3 scale s4 translate <1, 1, 2> }
   //   object { lev3 scale s4 translate <2, 1, 2> }
        object { lev3 scale s4 translate <3, 1, 2> }
   //   object { lev3 scale s4 translate <1, 2, 2> }
   //   object { lev3 scale s4 translate <2, 2, 2> }
   //   object { lev3 scale s4 translate <3, 2, 2> }
        object { lev3 scale s4 translate <1, 3, 2> }
   //   object { lev3 scale s4 translate <2, 3, 2> }
        object { lev3 scale s4 translate <3, 3, 2> }

        object { lev3 scale s4 translate <1, 1, 3> }
        object { lev3 scale s4 translate <2, 1, 3> }
        object { lev3 scale s4 translate <3, 1, 3> }
        object { lev3 scale s4 translate <1, 2, 3> }
   //   object { lev3 scale s4 translate <2, 2, 3> }
        object { lev3 scale s4 translate <3, 2, 3> }
        object { lev3 scale s4 translate <1, 3, 3> }
        object { lev3 scale s4 translate <2, 3, 3> }
        object { lev3 scale s4 translate <3, 3, 3> }

        translate <-2, -2, -2>

        scale 1/3

        }

    #declare lev5 = union {

        object { lev4 scale s5 translate <1, 1, 1> }
        object { lev4 scale s5 translate <2, 1, 1> }
        object { lev4 scale s5 translate <3, 1, 1> }
        object { lev4 scale s5 translate <1, 2, 1> }
   //   object { lev4 scale s5 translate <2, 2, 1> }
        object { lev4 scale s5 translate <3, 2, 1> }
        object { lev4 scale s5 translate <1, 3, 1> }
        object { lev4 scale s5 translate <2, 3, 1> }
        object { lev4 scale s5 translate <3, 3, 1> }

        object { lev4 scale s5 translate <1, 1, 2> }
   //   object { lev4 scale s5 translate <2, 1, 2> }
        object { lev4 scale s5 translate <3, 1, 2> }
   //   object { lev4 scale s5 translate <1, 2, 2> }
   //   object { lev4 scale s5 translate <2, 2, 2> }
   //   object { lev4 scale s5 translate <3, 2, 2> }
        object { lev4 scale s5 translate <1, 3, 2> }
   //   object { lev4 scale s5 translate <2, 3, 2> }
        object { lev4 scale s5 translate <3, 3, 2> }

        object { lev4 scale s5 translate <1, 1, 3> }
        object { lev4 scale s5 translate <2, 1, 3> }
        object { lev4 scale s5 translate <3, 1, 3> }
        object { lev4 scale s5 translate <1, 2, 3> }
   //   object { lev4 scale s5 translate <2, 2, 3> }
        object { lev4 scale s5 translate <3, 2, 3> }
        object { lev4 scale s5 translate <1, 3, 3> }
        object { lev4 scale s5 translate <2, 3, 3> }
        object { lev4 scale s5 translate <3, 3, 3> }

        translate <-2, -2, -2>

        scale 1

        }

        object { lev5 }

        light_source { <2, 2, 2> White }
        light_source { <0, 0, 0> White*.75}


Post a reply to this message

From: Alex
Subject: Re: Can anyone parse this correctly?
Date: 19 Jul 2005 13:38:35
Message: <0yu2PNRMdT3CFweO@lazysod.org.uk>
In message <web.42dd1fe9e652faa392a4d1390@news.povray.org>, 
FractalMBrown <fractalmbrown_AT_QX_DOT_NET@?.?.invalid> writes
>I am attempting to render a 1600x1200 AA 0.3 version of a level 5 Menger
>Sponge. However, it will crash with a "POV-Ray for Windows has encountered
>an error" message after about two minutes, occasionally. And, when it does
>appear to parse correctly, there is no render window and the statistics say
>that the entire four minutes was spent on render time. I check the folder
>and find a 640x480 bitmap file, which is not what I wanted. It will also
>crash for me if I try 800x600 no AA. I run Windows XP Home with POV-Ray
>3.6.
>
Watching system monitor on my win98 machine was quite frightening! You 
do realise your scene contains 3.2 million cubes at level 5?
Each level uses 20 times as many objects as the previous, level 4 has 
160,000 and used 374 megabytes of ram.

3 suggestions come to mind, neither particularly helpful:

1) Stick to level 4

2) Upgrade to a 64 bit machine with gigs of ram

3) Most of the cubes will not be visible. Maybe they could be removed, 
but that could then affect the radiosity calculations.
I expect that to be a non-trivial exercise, and better suited to a 
recursive macro method of scene generation.

If you didn't want the gaps between the cubes I'd suggest starting with 
1 solid cube and cutting holes through it with a recursive macro (I like 
recursion!). That would scale by 9x the number of objects per level 
instead of 20.
-- 
Alex


Post a reply to this message

From: FractalMBrown
Subject: Re: Can anyone parse this correctly?
Date: 20 Jul 2005 09:15:01
Message: <web.42de4da63aea88d292a4d1390@news.povray.org>
Alex <pov### [at] lazysodorguk> wrote:
> In message <web.42dd1fe9e652faa392a4d1390@news.povray.org>,
> FractalMBrown <fractalmbrown_AT_QX_DOT_NET@?.?.invalid> writes
> >I am attempting to render a 1600x1200 AA 0.3 version of a level 5 Menger
> >Sponge. However, it will crash with a "POV-Ray for Windows has encountered
> >an error" message after about two minutes, occasionally. And, when it does
> >appear to parse correctly, there is no render window and the statistics say
> >that the entire four minutes was spent on render time. I check the folder
> >and find a 640x480 bitmap file, which is not what I wanted. It will also
> >crash for me if I try 800x600 no AA. I run Windows XP Home with POV-Ray
> >3.6.
> >
> Watching system monitor on my win98 machine was quite frightening! You
> do realise your scene contains 3.2 million cubes at level 5?
> Each level uses 20 times as many objects as the previous, level 4 has
> 160,000 and used 374 megabytes of ram.
>
> 3 suggestions come to mind, neither particularly helpful:
>
> 1) Stick to level 4
>
> 2) Upgrade to a 64 bit machine with gigs of ram
>
> 3) Most of the cubes will not be visible. Maybe they could be removed,
> but that could then affect the radiosity calculations.
> I expect that to be a non-trivial exercise, and better suited to a
> recursive macro method of scene generation.
>
> If you didn't want the gaps between the cubes I'd suggest starting with
> 1 solid cube and cutting holes through it with a recursive macro (I like
> recursion!). That would scale by 9x the number of objects per level
> instead of 20.
> --
> Alex


I have been able to create a solid Menger Sponge, merely by changing s1
through s5 all to 1.0. I could use a "Merge" command on the entire thing
after that. I realize the memory constraints on this, as I calculated the
memory usage of the cubes alone, totalling 781.25 megabytes for 3.2 million
cubes. Add radiosity and light calculations, and it jumps up
astronomically. At first I thought it was a 32 bit limit on POV-Ray, but
I've been told from both you and a friend of mine that it couldn't allocate
enough memory. I'll try merging them all into a solid cube and see what
happens *crosses fingers*


Post a reply to this message

From: Alex
Subject: Re: Can anyone parse this correctly?
Date: 20 Jul 2005 13:01:04
Message: <b8fdcxGLNo3CFwqZ@lazysod.org.uk>
In message <web.42de4da63aea88d292a4d1390@news.povray.org>, 
FractalMBrown <fractalmbrown_AT_QX_DOT_NET@?.?.invalid> writes
<snip>
>
>
>I have been able to create a solid Menger Sponge, merely by changing s1
>through s5 all to 1.0. I could use a "Merge" command on the entire thing
>after that. I realize the memory constraints on this, as I calculated the
>memory usage of the cubes alone, totalling 781.25 megabytes for 3.2 million
>cubes. Add radiosity and light calculations, and it jumps up
>astronomically. At first I thought it was a 32 bit limit on POV-Ray, but
>I've been told from both you and a friend of mine that it couldn't allocate
>enough memory. I'll try merging them all into a solid cube and see what
>happens *crosses fingers*
>
>
Going by what I saw with levels 2,3 and 4, I reckon on 7.5 Gbytes.

As for using the merge, I don't think that will solve the memory issues. 
Merge just makes the interior faces invisible for when you have a 
transparent object, PovRay will still store all the details of each cube 
as before. And the surfaces will be co-incident, so merge probably 
wouldn't work at all anyway.

I'll have a little play after I've had some lunch, see what I can come 
up with. There's more than one way to skin a cat.
-- 
Alex


Post a reply to this message

From: Alex
Subject: Re: Can anyone parse this correctly?
Date: 20 Jul 2005 14:55:55
Message: <muMyohKG0p3CFwcg@lazysod.org.uk>
In message <b8f### [at] lazysodorguk>, Alex <pov### [at] lazysodorguk>
writes

<snip>
>
>I'll have a little play after I've had some lunch, see what I can come
>up with. There's more than one way to skin a cat.

This code uses a lot less memory (even with radiosity added), but it
does render much more slowly. Your cubes approach is well suited to
hierarchical bounding. My method generates a union of long and
progressively thinner boxes, which are used with 2 other rotated copies
to cut holes out of a cube. This can't be efficiently bound.

It's worth noting that my level 4 is equivalent to your level 5, we both
start from a different point.




global_settings{
  assumed_gamma 1.0
  max_trace_level 6
  adc_bailout 1/250
  }

#include "colors.inc"



// posn - x,y co-ords of centre of current square
// sz   - width of square. centre 3rd will be cut out,
//        surrounding 8 sections call macro recursively
// levl - current recursion level



#macro do_holes(posn,sz,levl)
  box{posn-<1,1,0>*sz/6-z*0.51,posn+<1,1,0>*sz/6+z*0.51}

  #if (levl>0)

    do_holes(posn+<1,0,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<1,1,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<0,1,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<-1,1,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<-1,0,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<-1,-1,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<0,-1,0>/3*sz,sz/3,levl-1)
    do_holes(posn+<1,-1,0>/3*sz,sz/3,levl-1)

  #end //if levl
#end  //macro


#declare holes=union{
  do_holes(<0,0>,1,2)      // last number here controls recursion depth
  }


difference{
  box{-1/2,1/2}
  object {holes}
  object {holes rotate <90,0,0>}
  object {holes rotate <0,90,0>}

  texture{
    pigment{rgb <8,3,0>/9}
    finish{ambient 0 diffuse 1}
    }
  }




light_source{<60,50,-50> colour Gray40}
light_source{<-60,50,-50> colour Gray20}
light_source{<0,-70,-50> colour Gray10}


camera {
  right 4*x
  up 3*y
  direction 10*z
  location <4,3,-7>
  look_at <0,0,0>
  }



Hope this is of some help.

Another thought: Mine is too slow. You could maybe combine the two
approaches? Declare mine at level 2 as an object, and use that in place
of the source cube in your code at level 2.
-- 
Alex


Post a reply to this message

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