POV-Ray : Newsgroups : povray.advanced-users : Povtree macro (mesh created at parsing whith loops) seems to waste memory : Re: Povtree macro (mesh created at parsing whith loops) seems towaste memo= Server Time
20 Apr 2024 08:40:57 EDT (-0400)
  Re: Povtree macro (mesh created at parsing whith loops) seems towaste memo=  
From: Thomas de Groot
Date: 21 Jul 2018 07:21:57
Message: <5b531755$1@news.povray.org>
On 21-7-2018 12:31, clipka wrote:
> Am 21.07.2018 um 11:46 schrieb Warren:
> 
>> - If I stick to the TOMTREE-1.5.inc file and choose not to generate a mesh file
>> with povtree , I get a CSG object , i.e, a union of blob and mesh (only the
>> leaves are meshes; the trunk, twigs, branches and ramifications are blob of
>> spheres (no cylinders, but that's a detail). And there can be height fields too
>> (though I'm not sure), there are height fields objects in 'TOMLEAF.inc' which is
>> a file used with TOMTREE-1.5.inc.

In TOMtree, leaves can be defined as height_fields instead of spheres. I 
/think/ this can be defined also in POVtree but I seem to remember (it's 
been a long time since I last used the program) that this generates an 
error. Never corrected at the time, /if/ it was ever reported to Gena 
Obukhov...

> ...
>> But Clipka said that blobs, height fileds and meshes share their bulk data among
>> copies. So, if I understand that the CSG mesh file that contains FOLIAGE and
>> WOOD is not copied each time a new sample of it is created, why is this not the
>> case of the CSG object generated by TOMTREE-1.5.inc ?
> 
> You say that "the leaves are meshes"; if by that you mean that there is
> a leaf mesh, and the foliage of a single tree is multiple copies of that
> mesh, that does explain the symptoms.

When the tree is exported as a mesh, FOLIAGE is a mesh{} of /all/ the 
leaves of the tree, not individual meshes for each leaf.

> 
> While meshes do share their bulk data when copied, they each carry their
> own individual overhead, which is heavier than one might think.
> 
> If you use one mesh per leaf, you have a lot of overhead per triangle in
> the mesh, and thus the data sharing reduces the memory footprint only by
> a marginal fraction.

Not the case with POVtree (see above).

> 
> If instead of one mesh per leaf you use one huge mesh for the entire
> foliage of the tree, you only have one instance of the overhead. You do
> have much more bulk data, and unless the leaf mesh is trivially simple
> this may actually leave you with a larger total memory footprint for a
> single tree; but as soon as you create multiple instances of that tree,
> the impact of the bulk data on the total memory footprint quickly
> diminishes.
> 

That is what happens with POVtree meshes indeed.

> 
>> The CSG object generated by TOMTREE-1.5.inc (from Tom Aust) is a 'compound'
>> object. That means it is a 'mix' of several different objects, which explains
>> like clipka said that it is an object that is therefore copied each time you
>> create a new sample of it ?
>> Whereas the object that is a union of WOOD and FOLIAGE is not a 'compound'
>> object, that's a mesh even if there is a union of these two meshes.
>>
>> Is this the cornerstone that explains that one is copied and the other not?
> 
> The term "compound object" in the context of POV-Ray is typically used
> in the sense of "non-primitive", i.e. an object that is comprised of
> other objects. Whether the members of such compound object are of same
> type or different types is irrelevant, as there's no special processing
> happening in same-type cases.
> 


-- 
Thomas


Post a reply to this message

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