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 to waste memo= Server Time
18 Apr 2024 10:17:50 EDT (-0400)
  Re: Povtree macro (mesh created at parsing whith loops) seems to waste memo=  
From: clipka
Date: 21 Jul 2018 06:31:15
Message: <5b530b73@news.povray.org>
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.
...
> 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.

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.

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.


> 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.


Post a reply to this message

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