POV-Ray : Newsgroups : povray.advanced-users : memory usage & large number of objects Server Time
29 Jun 2024 01:50:29 EDT (-0400)
  memory usage & large number of objects (Message 1 to 7 of 7)  
From: Folkert van Heusden
Subject: memory usage & large number of objects
Date: 17 Nov 2009 05:40:28
Message: <4b027d9c$1@news.povray.org>
Hi,

I'm trying to render a scene with a large number of objects (scene 
generated by a 3D fractal); 3 milion and more objects.
As you'll understand this will use a lot of memory.
Now I was wondering: what object is the most memory efficient? Currently 
Currently I'm using "box { <here> <there> texture { pigment { rgb <0.25, 
1.0, 0.25> } } }" but maybe other objects use less resources?
Also I set for each object the color but it is the same color for all of 
them. Maybe that can be optimized?


Thanks,

Folkert van Heusden
www.vanheusden.com


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 06:48:50
Message: <op.u3je3ok67bxctx@e6600>
On Tue, 17 Nov 2009 11:40:28 +0100, Folkert van Heusden  
<fol### [at] vanheusdencom> wrote:
>
> I'm trying to render a scene with a large number of objects (scene
> generated by a 3D fractal); 3 milion and more objects.
> As you'll understand this will use a lot of memory.
> Now I was wondering: what object is the most memory efficient?

If triangles will suffice, then generating a mesh should be the most  
efficient.



> Also I set for each object the color but it is the same color for all of
> them. Maybe that can be optimized?

Far more efficient to use a single texture/material applied to the  
aggregate object.



-- 
FE


Post a reply to this message

From: Folkert van Heusden
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 07:01:55
Message: <4b0290b3$1@news.povray.org>
>> I'm trying to render a scene with a large number of objects (scene
>> generated by a 3D fractal); 3 milion and more objects. As you'll
>> understand this will use a lot of memory. Now I was wondering: what
>> object is the most memory efficient?
> 
> If triangles will suffice, then generating a mesh should be the most
> efficient.

Will try.
But are you sure? As you then have twice as much objects.
Or are boxes internally split-up in 6 x 2 (2 triangles per side) 
triangles?

 
>> Also I set for each object the color but it is the same color for all
>> of them. Maybe that can be optimized?
> Far more efficient to use a single texture/material applied to the
> aggregate object.

What do you mean with aggregate? According to wikipedia it means 
composite (am not a native speaker. Does that mean with respect to povray 
something like this?

#declare myobj =
        box { <0, 0, 0>, <1, 1, 1> texture { pigment { rgb <0.25, 1.0, 
0.25 } } }

and then use

object { myobj rotate <somevalue> translate <someohter> }

?


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 07:11:53
Message: <op.u3jf53eo7bxctx@e6600>
On Tue, 17 Nov 2009 13:01:55 +0100, Folkert van Heusden  
<fol### [at] vanheusdencom> wrote:
>> If triangles will suffice, then generating a mesh should be the most
>> efficient.
>
> Will try.
> But are you sure? As you then have twice as much objects.

You collect all the triangles into a single mesh object.

http://www.povray.org/documentation/view/3.6.1/292/
http://www.povray.org/documentation/view/3.6.1/293/



>> Far more efficient to use a single texture/material applied to the
>> aggregate object.
>
> What do you mean with aggregate?

http://www.povray.org/documentation/view/3.6.1/304/



A few examples of what can be accomplished with the right approach:

http://news.povray.org/povray.binaries.images/message/%3Copr48epnpgzjc5hb%40news.povray.org%3E


-- 
FE


Post a reply to this message

From: Fredrik Eriksson
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 07:13:53
Message: <op.u3jf9eqo7bxctx@e6600>
> A few examples of what can be accomplished with the right approach:
>
>
http://news.povray.org/povray.binaries.images/message/%3Copr48epnpgzjc5hb%40news.povray.org%3E

I accidentally hit Send too soon...

I meant to also include:
http://news.povray.org/povray.binaries.images/message/%3Copr6rtu8fxzjc5hb%40news.povray.org%3E



-- 
FE


Post a reply to this message

From: clipka
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 19:52:11
Message: <4b03453b$1@news.povray.org>
Folkert van Heusden schrieb:

> I'm trying to render a scene with a large number of objects (scene 
> generated by a 3D fractal); 3 milion and more objects.
> As you'll understand this will use a lot of memory.
> Now I was wondering: what object is the most memory efficient? Currently 
> Currently I'm using "box { <here> <there> texture { pigment { rgb <0.25, 
> 1.0, 0.25> } } }" but maybe other objects use less resources?
> Also I set for each object the color but it is the same color for all of 
> them. Maybe that can be optimized?

This definitely calls for "blob" or "mesh"/"mesh2".

If you use suitable parameters, the blob object will behave almost as a 
collection of spheres. (Note that there is some upper limit on the total 
number of blob elements, and you may even need a multitude of blob objects.)

With mesh or mesh2 objects (both are just different syntax variants for 
one and the same underlying object), you can assemble whatever you deem 
the most fitting basic shape: Boxes, tetrahedrons, or maybe just plain 
flat triangles. (Maybe there's a limit on the number of triangles there, 
too, but I never met any.)

Both objects support either per-element or per-object texturing. I don't 
think it makes any difference memory-wise as long as you use just a 
small set of #define'd textures.


As an alternative, you might also try using a df3 file (basically a 3D 
bitmap) as the basis for an isosurface. If you intend to have a 
densely-filled space, then this is likely to be the most 
memory-efficient way to go, and may also be easiest to generate.


Post a reply to this message

From: clipka
Subject: Re: memory usage & large number of objects
Date: 17 Nov 2009 20:01:50
Message: <4b03477e@news.povray.org>
Folkert van Heusden schrieb:
>>> I'm trying to render a scene with a large number of objects (scene
>>> generated by a 3D fractal); 3 milion and more objects. As you'll
>>> understand this will use a lot of memory. Now I was wondering: what
>>> object is the most memory efficient?
>> If triangles will suffice, then generating a mesh should be the most
>> efficient.
> 
> Will try.
> But are you sure? As you then have twice as much objects.
> Or are boxes internally split-up in 6 x 2 (2 triangles per side) 
> triangles?

Boxes, like any objects in POV-Ray, are not represented as polygon 
meshes (except for mesh objects of course :-)), but as a set of 
parameters to an object-type-soecific algorithm that will test whether 
and where a straight line intersects the object, or whether a given 
point is inside the object.

Theoretically, this would leave you with two coordinate points for 
boxes, but three coordinate points for triangles.

In practice however, each object also stores a bunch of additional data 
common to /all/ object types: A transformation matrix, a reference to a 
texture, and a reference to an interior, to name just a few.

With a bunch of boxes, you get this overhead once per box. With a mesh, 
you get this overhead once per mesh.


> What do you mean with aggregate? According to wikipedia it means 
> composite (am not a native speaker. Does that mean with respect to povray 
> something like this?
> 
> #declare myobj =
>         box { <0, 0, 0>, <1, 1, 1> texture { pigment { rgb <0.25, 1.0, 
> 0.25 } } }
> 
> and then use
> 
> object { myobj rotate <somevalue> translate <someohter> }

No, more like

union {
   box {...}
   box {...}
   box {...}
   ...
   texture { ... }
}


Post a reply to this message

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