POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature Request - Hierarchal Instancing Server Time
27 Dec 2024 21:33:55 EST (-0500)
  Feature Request - Hierarchal Instancing (Message 1 to 4 of 4)  
From: slongay
Subject: Feature Request - Hierarchal Instancing
Date: 21 Nov 2008 19:45:00
Message: <web.49275535e09ccb2f2ebc1c00@news.povray.org>
One feature I would love to see implemented in POVRay 4.0 is Hierarchal
Instancing. What I mean by this is the following:

#declare leafMesh = mesh { triangles...}

#declare myTree = meshHierarchy {
object { leafMesh translate<> rotate<> scale<> }
object { leafMesh translate<> rotate<> scale<> }
....
}

Then in the scene I can instance this myTree object as many times as I want with
a negligible increase in memory footprint.

Currently you can make a structure like the following:

#declare leafMesh = mesh { triangles...}

#declare myTree = union {
object { leafMesh translate<> rotate<> scale<> }
object { leafMesh translate<> rotate<> scale<> }
....
}

The problem is, say if you are trying to render a huge tree which has 100 000
leaves in it. This definition of the union is now 100 000 lines long. When you
try to instance this all over your scene it appears that POVRay does indeed
instance the leafMesh properly but it does not instance this 100 000 line union
definition.  At this scale the union definition consumes a substantial amount of
memory and thus making copies all over your scene is impossible.

Of course one way to fix this (which is what I currently use) is to create a
massive mesh which consists of all the triangles for every leaf in its desired
position explicitly specified. Then I can declare the following

#declare myTree = union {
object { myLeaves translate<> rotate<> scale<> }
object { myBranches translate<> rotate<> scale<> }
}

This works but the myLeaves mesh takes up a substantial amount of memory
unnecessarily as each leaf within it is just an affine transformation of the
same mesh.


-Steve


Post a reply to this message

From: Warp
Subject: Re: Feature Request - Hierarchal Instancing
Date: 22 Nov 2008 02:07:24
Message: <4927afab@news.povray.org>
slongay <slo### [at] gmailcom> wrote:
> This works but the myLeaves mesh takes up a substantial amount of memory
> unnecessarily as each leaf within it is just an affine transformation of the
> same mesh.

  Unless your leafMesh is rather large, I don't think there is a significant
amount of memory saving if you make instances of it, each one having an
internal transformation matrix, compared to duplicating those triangles
inside a mesh object. An object instantiation (which consists of a relatively
large amount of data, including a transformation matrix) requires a fair
amount of memory. Although I must admit I don't know how many triangles a
mesh must have before it becomes more memory consuming.

-- 
                                                          - Warp


Post a reply to this message

From: slongay
Subject: Re: Feature Request - Hierarchal Instancing
Date: 22 Nov 2008 16:25:00
Message: <web.492877b0a05cf98e2ebc1c00@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> slongay <slo### [at] gmailcom> wrote:
> > This works but the myLeaves mesh takes up a substantial amount of memory
> > unnecessarily as each leaf within it is just an affine transformation of the
> > same mesh.
>
>   Unless your leafMesh is rather large, I don't think there is a significant
> amount of memory saving if you make instances of it, each one having an
> internal transformation matrix, compared to duplicating those triangles
> inside a mesh object. An object instantiation (which consists of a relatively
> large amount of data, including a transformation matrix) requires a fair
> amount of memory. Although I must admit I don't know how many triangles a
> mesh must have before it becomes more memory consuming.
>
> --
>                                                           - Warp

Well I've done a few tests with it. My test tree using the massive union method
POVRay consumes 192mb in memory max when rendering. This is instantiating every
leaf ( which is not too large ). When when I make 22 copies of the tree POVRay
consumes 675mb.

Using the massive mesh approach, a tree (of roughly the same size) uses 185mb
max to render, and 22 copies of it uses 185mb max to render.

So that being said, I dont think there is much memory savings when instantiating
the leaves but the difference in file size is about 6x larger using the mass
mesh approach. Which in turn takes longer to parse.

I guess the feature I am really requesting is for POVRay to instantiate unions
instead of making copies of them. (Or at least thats what I think it does).
This way the massive union approach would would be the best as the file size is
small and it would be able to be instantiated.

-Steve


Post a reply to this message

From: Warp
Subject: Re: Feature Request - Hierarchal Instancing
Date: 23 Nov 2008 10:54:44
Message: <49297cc4@news.povray.org>
slongay <slo### [at] gmailcom> wrote:
> I guess the feature I am really requesting is for POVRay to instantiate unions
> instead of making copies of them.

  "Instantiate" is not really the correct word, but anyways, the point is
that you would want unions (and maybe other objects) to behave like meshes
in that making several instances of the same object only creates references
to the original, rather than copies.

  This gave me a feature idea, which I submitted to the developers for
rumination.

-- 
                                                          - Warp


Post a reply to this message

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