POV-Ray : Newsgroups : povray.advanced-users : Multi-usage of an object : Re: Multi-usage of an object Server Time
28 Jul 2024 10:25:28 EDT (-0400)
  Re: Multi-usage of an object  
From: Jim Charter
Date: 19 May 2006 14:51:19
Message: <446e13a7$1@news.povray.org>
McHannemann wrote:
> I have the following problem:
> I have a list of objects which I want to use several times,
> a list with the positions is created and I create the object this way:
> 
> #while(counter < Number )
>  object{List[position[counter]] transform Transfer[counter]}
>  #declare counter = counter + 1;
>  #if (mod(counter,10)=0)
>   #debug concat(str(counter,0,0),"..")
>  #end
>  #if (mod(counter,100)=0)
>   #debug "n"
>  #end
> #end
> 
> now to my question,
> this way I create 50000 pieces of one object
> and I get 800MB memory usage,


> with nearly no memory consumption..what do I wrong in this case????
> 
The idea of reusing an object with little additional memory cost relates 
to objects that themselves have components such as the mesh{} object and 
the blob{} object.  But the initial declaration of a mesh{}, say, will 
require lots of memory if it is comprised of many triangles.  However 
once declared, it can be instanced multiple times without additionally 
multiplying the memory needs.
IE.
#declare M =
mesh {
     triangle {...},
     triangle {...},
     ...
     triangle {...}
};

LOOP
     object { M transform {...} }
END LOOP


BUT
This effect cannot be achieved by unioning a group of objects:

#declare U =
union {
     triangle {...},
     triangle {...},
     ...
     triangle {...}
};

LOOP
     object { U transform {...} }
END LOOP
would multiply the memory cost


Post a reply to this message

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