POV-Ray : Newsgroups : povray.general : Instancing Trees : Re: Instancing Trees Server Time
30 Jul 2024 16:15:06 EDT (-0400)
  Re: Instancing Trees  
From: Leroy Whetstone
Date: 16 Oct 2008 00:14:26
Message: <48F6DBE5.2020608@joplin.com>
slongay wrote:
> Hi, I am trying to build a scene with many trees though many of the trees can be
> the same just rotated or scaled slightly. My current setup is as follows
> 
> #declare leaf1 = mesh { smooth_triangle ... }
> #declare leaf2 = mesh { smooth_triangle ... }
> 
> #declare tree = object { union {
> mesh { triangles for a branch }
> mesh { triangles for another branch}
> .... // for all branches
> object { object { object { leaf1 scale<x,y,z> } matrix ...} translate<x,y,z> }
> object { object { object { leaf2 scale<x,y,z> } matrix ...} translate<x,y,z> }
> .... // continues for all leaves
> }
> translate<x,y,z> // to place the base of the model at <0,0,0>
> scale<x,y,z> // to adjust the size of the model
> }
> 
> 
> Then in my program I instance this tree object many times with
> 
> object { tree scale<x,y,z> rotate<x,y,z> translate<x,y,z> }
> 
> But this causes POV-ray to run out of memory very quickly so I don't think this
> is instancing the geometry properly.
> 
> From reading the manual it says that mesh's can be instanced but is it because I
> have a bunch of mesh's in a union that this does not work?
> 
> Is the only solution to this to make one massive mesh which has all branch
> geometry and all leaf geometry inside it and then instance that?
> 
> Thanks
> -Steve
> 
> 
> 


Funny you should ask about mesh trees. I'm just about finished making my 
own POV tree generator. And I use one 'massive' mesh2 for the Tree and 
one for the Leafs. That really doesn't bother me. In my earlier attempts 
I used a 'mesh' with 'smooth_triangle' as you have. But I dropped them 
because they where not flexible enough and kind of hard to work with.
Sense it seems you have a good looking tree using them, my hat is off to ya.
  Now on to your problem. But, first some questions.
(1) How many different trees do you have?
(2) How detailed are they?
(3) How many are you planing to place?
Here's my shot in the dark:
(1) You probably need at least two different trees if your placing a lot.
    I've done a forest seen from far away and used several.
    Scaling and rotation only goes so far in making a tree look
    different.
(2) The farther away a tree is the less detail it has to have.
    If it's real far some times all it needs is its leafs.
(3) The number of trees you want to place and the number of trees that
    will fill the space may be different.

But I ramble.
   If you like I'll put My tree generator in P.B.utilities
    along with a test scene in p.b.scene_files

Have Fun!


Post a reply to this message

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