POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature Request - Hierarchal Instancing : Feature Request - Hierarchal Instancing Server Time
30 Apr 2024 20:35:56 EDT (-0400)
  Feature Request - Hierarchal Instancing  
From: slongay
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

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