POV-Ray : Newsgroups : povray.newusers : Out of memory Server Time
21 Dec 2024 13:27:53 EST (-0500)
  Out of memory (Message 1 to 9 of 9)  
From: zoli0726
Subject: Out of memory
Date: 30 Nov 2014 20:20:00
Message: <web.547bc1a0298a9d1a521a8b650@news.povray.org>
Hi!

I could appreciate some help, because im stuck.

I want to render about 2 million spheres and about 10 million cone-s which
connecting them on a scene, but the parser fills all of my memory (16gb). I have
every sphere individually in the pov file, because their coordinate and color
are different. It doesnt matter which quality im using because i cant even pass
the parsing.
Is there any good method to reduce memory usage, or the only option is more
memory?

Thanks.


Post a reply to this message

From: Nekar Xenos
Subject: Re: Out of memory
Date: 1 Dec 2014 00:10:01
Message: <web.547bf7b754eeb2e586de6e960@news.povray.org>
"zoli0726" <nomail@nomail> wrote:
> Hi!
>
> I could appreciate some help, because im stuck.
>
> I want to render about 2 million spheres and about 10 million cone-s which
> connecting them on a scene, but the parser fills all of my memory (16gb). I have
> every sphere individually in the pov file, because their coordinate and color
> are different. It doesnt matter which quality im using because i cant even pass
> the parsing.
> Is there any good method to reduce memory usage, or the only option is more
> memory?
>
> Thanks.
We would need a bit more information. What kind of materials do these objects
have? Are they meshes or procedural objects?

-Nekar Xenos-


Post a reply to this message

From: Thomas de Groot
Subject: Re: Out of memory
Date: 1 Dec 2014 03:34:38
Message: <547c281e$1@news.povray.org>
On 1-12-2014 2:17, zoli0726 wrote:
> Hi!
>
> I could appreciate some help, because im stuck.
>
> I want to render about 2 million spheres and about 10 million cone-s which
> connecting them on a scene, but the parser fills all of my memory (16gb). I have
> every sphere individually in the pov file, because their coordinate and color
> are different. It doesnt matter which quality im using because i cant even pass
> the parsing.
> Is there any good method to reduce memory usage, or the only option is more
> memory?
>
> Thanks.
>
>

If all the sphere and cone definitions are also written individually, 
that is overkill. Better define one single sphere and one single cone at 
the origin, and make instances of them, only reading locations and 
colours sequentially from the file. That way POV-Ray only needs to keep 
one single object in memory. However, you would then need also some 
scale and rotation values in your file for connecting the instances. 
Still, that is the best solution to my mind.

Short example (without the needed scale and rotation parameters):

//start code
#declare MySphere = sphere {<0,0,0>, 1}
#declare MyCone = cone {<0,0,0>, 1, <0,1,0>, 0.5}

#fopen MyFile "SphereAndCone.inc" read

#while (defined (MyFile))
   #read {MyFile, Spherelocation, Spherecolour, ConeLocation, ConeColour)
   object {MySphere pigment {SphereColour} translate SphereLocation}
   object {MyCone pigment {ConeColour} translate ConeLocation}
#end

#fclose MyFile
//end code

Thomas


Post a reply to this message

From: Le Forgeron
Subject: Re: Out of memory
Date: 1 Dec 2014 10:01:28
Message: <547c82c8$1@news.povray.org>
Le 01/12/2014 09:34, Thomas de Groot a écrit :
> On 1-12-2014 2:17, zoli0726 wrote:
>> Hi!
>>
>> I could appreciate some help, because im stuck.
>>
>> I want to render about 2 million spheres and about 10 million cone-s
>> which
>> connecting them on a scene, but the parser fills all of my memory
>> (16gb). I have
>> every sphere individually in the pov file, because their coordinate
>> and color
>> are different. It doesnt matter which quality im using because i cant
>> even pass
>> the parsing.
>> Is there any good method to reduce memory usage, or the only option is
>> more
>> memory?
>>
>> Thanks.
>>
>>
> 
> If all the sphere and cone definitions are also written individually,
> that is overkill. Better define one single sphere and one single cone at
> the origin, and make instances of them, only reading locations and
> colours sequentially from the file. That way POV-Ray only needs to keep
> one single object in memory. However, you would then need also some
> scale and rotation values in your file for connecting the instances.
> Still, that is the best solution to my mind.
> 

It would work with meshes, but referencing a true sphere just make a
copy of it (well, if the texture is the same, that might save you the
texture block, but the transformation will be duplicated anyway, or
rather overwritten on the copy).

Swapping memory is free... sort of, it comes at the cost of a crawling
system.

Now, I would call for a sanity check, because not all spheres and cones
are to be visible on a picture of less than 12 megapixels. You need at
least one pixel per object for such scene to be useful... or you expect
a lot of reflection & refraction.



> Short example (without the needed scale and rotation parameters):
> 
> //start code
> #declare MySphere = sphere {<0,0,0>, 1}
> #declare MyCone = cone {<0,0,0>, 1, <0,1,0>, 0.5}
> 
> #fopen MyFile "SphereAndCone.inc" read
> 
> #while (defined (MyFile))
>   #read {MyFile, Spherelocation, Spherecolour, ConeLocation, ConeColour)
>   object {MySphere pigment {SphereColour} translate SphereLocation}
>   object {MyCone pigment {ConeColour} translate ConeLocation}
> #end
> 
> #fclose MyFile
> //end code
> 
> Thomas
> 


-- 
Just because nobody complains does not mean all parachutes are perfect.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Out of memory
Date: 1 Dec 2014 10:27:19
Message: <547c88d7$1@news.povray.org>
On 1-12-2014 16:01, Le_Forgeron wrote:
> It would work with meshes, but referencing a true sphere just make a
> copy of it (well, if the texture is the same, that might save you the
> texture block, but the transformation will be duplicated anyway, or
> rather overwritten on the copy).

err... yes, that is indeed correct. Maybe worthwhile to see if a union 
of a sphere and several cones might be possible. Then, referencing the 
union would free memory in my view, or am I wrong there?

Thomas


Post a reply to this message

From: MichaelJF
Subject: Re: Out of memory
Date: 1 Dec 2014 12:35:01
Message: <web.547ca65454eeb2e5d5b0a6d50@news.povray.org>
"zoli0726" <nomail@nomail> wrote:
> Hi!
>
> I could appreciate some help, because im stuck.
>
> I want to render about 2 million spheres and about 10 million cone-s which
> connecting them on a scene, but the parser fills all of my memory (16gb). I have
> every sphere individually in the pov file, because their coordinate and color
> are different. It doesnt matter which quality im using because i cant even pass
> the parsing.
> Is there any good method to reduce memory usage, or the only option is more
> memory?
>
> Thanks.

I think, it is not possible to answer your question in general. Stephen is
completely right in requesting your code, so that one can judge, what you intend
to do. Le Forgeron is completely right that the main part of your
million objects will not be visible in your final scene - most likely. First due
to the size of the image in pixels and second because it is likely that a lot of
your objects are hidden by others. Try to leave the invisible
ones out.

I have only a very vague idea of your intended image (brain synapses may be),
but if I'm right, you should try to find a way to determine what sphere is in a
first layer, which in a second, which in a third (and so on) in distance to the
camera, display only the first four layers (and forget about all spheres and
cones beyond) and use focal blur to display only the first (and maybe second)
layer of spheres in focus and blur the rest away. The third and fourth layer
will give enough impression of "depth" without the need of displaying all your
spheres.

Best regards,

Michael


Post a reply to this message

From: Alain
Subject: Re: Out of memory
Date: 1 Dec 2014 17:00:16
Message: <547ce4f0$1@news.povray.org>

> Hi!
>
> I could appreciate some help, because im stuck.
>
> I want to render about 2 million spheres and about 10 million cone-s which
> connecting them on a scene, but the parser fills all of my memory (16gb). I have
> every sphere individually in the pov file, because their coordinate and color
> are different. It doesnt matter which quality im using because i cant even pass
> the parsing.
> Is there any good method to reduce memory usage, or the only option is more
> memory?
>
> Thanks.
>
>

All spheres and cones individualy seems to tell us that the POV file 
defines all of those one by one, and individualy apply a texture to each 
one. That makes your POV file uselessly huge.
Then, you need the space for the deffined objects including the texture 
block attached to each one of them. Even if tou don't have any explicite 
finish applyed, you still have space to contain a copy of the default finish

It would be beter to use a while or for loop to place them.
For the colours, do you realy need each object to have different 
pigments? With some 12 millions objects, you probably have many that 
share the same tint. How about putting them all in a single union and 
use some pattern as a pigment?
That way, you only have a single texture block instead of 12 millions of 
them. This can save you a few Gb.

If using a single pattern is not an option, you can still save a lot or 
memory using unions. One union use a pattern, and a second union use 
another pattern. Textures for 10 to 50 unions will use the same space as 
if they where applyed to 10 to 50 individual objects, whitch is a *LOT* 
less that what you have now.



Alain


Post a reply to this message

From: clipka
Subject: Re: Out of memory
Date: 1 Dec 2014 20:56:46
Message: <547d1c5e$1@news.povray.org>
Am 01.12.2014 02:17, schrieb zoli0726:
> Hi!
>
> I could appreciate some help, because im stuck.
>
> I want to render about 2 million spheres and about 10 million cone-s which
> connecting them on a scene, but the parser fills all of my memory (16gb). I have
> every sphere individually in the pov file, because their coordinate and color
> are different. It doesnt matter which quality im using because i cant even pass
> the parsing.
> Is there any good method to reduce memory usage, or the only option is more
> memory?

If you can make do with spheres and cylinders, blobs might save you some 
space.

If there are repeating structures, using blobs or meshes is the way to 
go, as these can be duplicated without copying all the data.

Alternatively, try rendering the image in "slices" of different depth in 
front of a transparent background (don't forget to enable alpha channel 
for the output image), and then overlaying the images in Photoshop or 
the like.


Post a reply to this message

From: Stephen
Subject: Re: Out of memory
Date: 2 Dec 2014 12:34:00
Message: <547df808@news.povray.org>
On 02/12/2014 01:56, clipka wrote:
>
> Alternatively, try rendering the image in "slices" of different depth in
> front of a transparent background (don't forget to enable alpha channel
> for the output image), and then overlaying the images in Photoshop or
> the like.

Alternatively, you could save the images as TGAs and using tga2df3.exe, 
create a DF3 file. This can be rendered as emitting media. Once you have 
created the DF3 file you can render it from any angle and location, 
without re-rendering the slices.
I did something similar with a fractal a couple of years ago.
It is an added complication though and I would leave it for later. :-)

-- 

Regards
     Stephen


Post a reply to this message

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