POV-Ray : Newsgroups : povray.binaries.images : tree creation Server Time
17 Nov 2024 04:16:52 EST (-0500)
  tree creation (Message 1 to 8 of 8)  
From: Lawrence W
Subject: tree creation
Date: 16 Aug 2006 14:05:00
Message: <web.44e35dcd1b38620b8a5251970@news.povray.org>
I've posted in the past about learning to create a tree macro all by myself.
 My trouble at this point is to figure out how to attach each block of truck
to each other when shifted out of alignment, a la not a perfectly straight
truck.

If you look at the attached image, you'll see I've got a cylinder broken
into four chunks, along with a solid cylinder next to it.  I want this to
be my trunk.  I'm looking to find out how to properly locate the beginning
and end points of each chunk.  That way, I could properly rotate each chunk
to meet up with the one below it.

Can anyone give me some help?  Thanks!


Post a reply to this message


Attachments:
Download 'new_tree.jpg' (12 KB)

Preview of image 'new_tree.jpg'
new_tree.jpg


 

From: Trevor G Quayle
Subject: Re: tree creation
Date: 16 Aug 2006 14:50:00
Message: <web.44e367f2665c4df4c150d4c10@news.povray.org>
"Lawrence W" <lwi### [at] csicablenet> wrote:
> I've posted in the past about learning to create a tree macro all by myself.
>  My trouble at this point is to figure out how to attach each block of truck
> to each other when shifted out of alignment, a la not a perfectly straight
> truck.
>
> If you look at the attached image, you'll see I've got a cylinder broken
> into four chunks, along with a solid cylinder next to it.  I want this to
> be my trunk.  I'm looking to find out how to properly locate the beginning
> and end points of each chunk.  That way, I could properly rotate each chunk
> to meet up with the one below it.
>
> Can anyone give me some help?  Thanks!

If you know the coordinates of each point of the trunk, you don'tneed to
rotate cylinders.  Cylinders do not need to be created vertical. Just
specify the start and end coordinates and you are done.

-tgq


Post a reply to this message

From: Lawrence W
Subject: Re: tree creation
Date: 16 Aug 2006 15:40:00
Message: <web.44e373cb665c4df48a5251970@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "Lawrence W" <lwi### [at] csicablenet> wrote:
> > I've posted in the past about learning to create a tree macro all by myself.
> >  My trouble at this point is to figure out how to attach each block of truck
> > to each other when shifted out of alignment, a la not a perfectly straight
> > truck.
> >
> > If you look at the attached image, you'll see I've got a cylinder broken
> > into four chunks, along with a solid cylinder next to it.  I want this to
> > be my trunk.  I'm looking to find out how to properly locate the beginning
> > and end points of each chunk.  That way, I could properly rotate each chunk
> > to meet up with the one below it.
> >
> > Can anyone give me some help?  Thanks!
>
> If you know the coordinates of each point of the trunk, you don'tneed to
> rotate cylinders.  Cylinders do not need to be created vertical. Just
> specify the start and end coordinates and you are done.
>
> -tgq

That's exactly my goal, but also the crux of my problem.  How am I going to
track the start and end coordinates?

.... This may become a rather moot point as I find it MUCH quicker to use
POV-Tree.  Nonetheless, I'm really curious about how to do it from scratch
for the learning potential.


Post a reply to this message

From: Cousin Ricky
Subject: Re: tree creation
Date: 16 Aug 2006 19:20:01
Message: <web.44e3a76d665c4df443a5e2560@news.povray.org>
"Lawrence W" <lwi### [at] csicablenet> wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> > If you know the coordinates of each point of the trunk, you don'tneed to
> > rotate cylinders.  Cylinders do not need to be created vertical. Just
> > specify the start and end coordinates and you are done.
>
> That's exactly my goal, but also the crux of my problem.  How am I going to
> track the start and end coordinates?

Maybe recursion is what you need?  That's my first instinct for anything
that has multiple levels of sub-branches.  (I know for a fact that
recursion works in POV-Ray.)  Are you familiar with that technique?


Post a reply to this message

From: Skip Talbot
Subject: Re: tree creation
Date: 17 Aug 2006 00:15:25
Message: <44e3ed5d$1@news.povray.org>
Lawrence W wrote:
> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
>> "Lawrence W" <lwi### [at] csicablenet> wrote:
>>> I've posted in the past about learning to create a tree macro all by myself.
>>>  My trouble at this point is to figure out how to attach each block of truck
>>> to each other when shifted out of alignment, a la not a perfectly straight
>>> truck.
>>>
>>> If you look at the attached image, you'll see I've got a cylinder broken
>>> into four chunks, along with a solid cylinder next to it.  I want this to
>>> be my trunk.  I'm looking to find out how to properly locate the beginning
>>> and end points of each chunk.  That way, I could properly rotate each chunk
>>> to meet up with the one below it.
>>>
>>> Can anyone give me some help?  Thanks!
>> If you know the coordinates of each point of the trunk, you don'tneed to
>> rotate cylinders.  Cylinders do not need to be created vertical. Just
>> specify the start and end coordinates and you are done.
>>
>> -tgq
> 
> That's exactly my goal, but also the crux of my problem.  How am I going to
> track the start and end coordinates?
> 
> .... This may become a rather moot point as I find it MUCH quicker to use
> POV-Tree.  Nonetheless, I'm really curious about how to do it from scratch
> for the learning potential.
> 
> 
The edges of the cylinder are going to jut out aren't they?  Maybe a 
different shape should be used?  Sphere sweeps perhaps?  Although they 
would probably bring the render to a screeching halt.  How about a mesh 
object?  Then you can have a macro to define the number of faces around 
the trunk (ie an octagon tree or something with a lot more faces to make 
it look smooth).  You could could easily connect vertices as the tree 
trunk curves, shrinking the radius as the tree goes to the top.  I'm not 
entirely sure how to mesh the branch intersections smoothly though (I 
guess they could just overlap).  The path of your tree trunk and 
branches could be defined with a spline.  Then you'll have a nice 
curving shape to start with, and picking start and end points for your 
cylinders merely involves evaluating the spline at the spline intervals 
you need.

Skip


Post a reply to this message

From: Tail Kinker
Subject: Re: tree creation
Date: 17 Aug 2006 08:33:06
Message: <44e46202@news.povray.org>
Lawrence W wrote:

>> If you know the coordinates of each point of the trunk, you don'tneed to
>> rotate cylinders.  Cylinders do not need to be created vertical. Just
>> specify the start and end coordinates and you are done.
>>
>> -tgq
> 
> That's exactly my goal, but also the crux of my problem.  How am I going to
> track the start and end coordinates?

I tackled this same problem a few years back.  My solution was to use a 
recursive call.

global_settings {
    assumed_gamma 1
    }

light_source {
    <1000, 1000, 1000>
    color rgb 1
    spotlight
    point_at 0
    radius 1
    falloff 5
    }

camera {
    location <120, 40, 0>
    look_at <0, 30, 0>
    }

plane {
    y, 0
    pigment {
       rgb <0, 0.3, 0>
       }
    }

#macro bloblike (lrad, srad, length)
    union {
       sphere {
       	 0, lrad
	 }
       sphere {
       	 <0, length, 0>, srad
	 }
       cone {
       	 0, lrad
	 <0, length, 0>, srad
	 }
       }
#end

#macro bloblike_run (number, cnt, lrad, length, bend, twist)
    #local srad = lrad * 0.9;
    #if (number = 1)
       object {
	 bloblike (lrad, srad, length)	
	 }
    #else
       union {
	 bloblike_run (number - 1, cnt, srad, length, bend, twist)
       	 object {
	    bloblike (lrad, srad, length)
	    }
	 rotate <bend, twist, 0>
	 #if (number != cnt)
	    translate <0, length, 0>
	 #end
	 }
    #end
#end

object {
    bloblike_run (10, 10, 4, 8, 7, 6)
    pigment {
       rgb <0.4, 0.2, 0>
       }
    }


Post a reply to this message


Attachments:
Download 'tree.jpg' (31 KB)

Preview of image 'tree.jpg'
tree.jpg


 

From: MSAB
Subject: Re: tree creation
Date: 17 Aug 2006 14:00:00
Message: <web.44e4ad92665c4df4a68196d10@news.povray.org>
Yeah, recursion is what you need. A few month ago, i also write a tree-macro
only for fun, which essential structure is like this:

#macro Tree(a,b,r,n)
 #if (n=0)
 cone { a,r, b,0.8*r }
 #else
 #local d=b-a;
 #local c=a+0.5*d;

 union{ cone {a,r, b,0.8*r }
 Tree(c,c+0.4*vrotate(d,-45*z),0.9*r,n-1)
 Tree(b,b+0.3*vrotate(d,45*z),0.8*r,n-1)
 Tree(b,b+0.9*vrotate(d,3*z),0.8*r,n-1)}
 #end
#end

At the end my macro is a bit complexer (see pic at the attachment)

Sorry for my bad englisch ;)


Post a reply to this message

From: Alain
Subject: Re: tree creation
Date: 18 Aug 2006 06:05:12
Message: <44e590d8$1@news.povray.org>
Skip Talbot nous apporta ses lumieres en ce 17/08/2006 00:15:
> Lawrence W wrote:
>> "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
>>> "Lawrence W" <lwi### [at] csicablenet> wrote:
>>>> I've posted in the past about learning to create a tree macro all by 
>>>> myself.
>>>>  My trouble at this point is to figure out how to attach each block 
>>>> of truck
>>>> to each other when shifted out of alignment, a la not a perfectly 
>>>> straight
>>>> truck.
>>>>
>>>> If you look at the attached image, you'll see I've got a cylinder 
>>>> broken
>>>> into four chunks, along with a solid cylinder next to it.  I want 
>>>> this to
>>>> be my trunk.  I'm looking to find out how to properly locate the 
>>>> beginning
>>>> and end points of each chunk.  That way, I could properly rotate 
>>>> each chunk
>>>> to meet up with the one below it.
>>>>
>>>> Can anyone give me some help?  Thanks!
>>> If you know the coordinates of each point of the trunk, you don'tneed to
>>> rotate cylinders.  Cylinders do not need to be created vertical. Just
>>> specify the start and end coordinates and you are done.
>>>
>>> -tgq
>>
>> That's exactly my goal, but also the crux of my problem.  How am I 
>> going to
>> track the start and end coordinates?
>>
>> .... This may become a rather moot point as I find it MUCH quicker to use
>> POV-Tree.  Nonetheless, I'm really curious about how to do it from 
>> scratch
>> for the learning potential.
>>
>>
> The edges of the cylinder are going to jut out aren't they?  Maybe a 
> different shape should be used?  Sphere sweeps perhaps?  Although they 
> would probably bring the render to a screeching halt.  How about a mesh 
> object?  Then you can have a macro to define the number of faces around 
> the trunk (ie an octagon tree or something with a lot more faces to make 
> it look smooth).  You could could easily connect vertices as the tree 
> trunk curves, shrinking the radius as the tree goes to the top.  I'm not 
> entirely sure how to mesh the branch intersections smoothly though (I 
> guess they could just overlap).  The path of your tree trunk and 
> branches could be defined with a spline.  Then you'll have a nice 
> curving shape to start with, and picking start and end points for your 
> cylinders merely involves evaluating the spline at the spline intervals 
> you need.
> 
> Skip
You can use cones, maybe with spheres at the junctions.
If you use sphere_sweep, limit the lenght.
Using mesh is a prety good solution if you have several trees, like some 100's 
or more.
Make 1 or 2 close trees with cones or many sphere_sweep. Then, you use 2 ot 3 
different, scaled and randomly rotated mesh trees for the bulk of the forest.

-- 
Alain
-------------------------------------------------
WARNING: The consumption of alcohol may create the illusion that you are 
tougher, smarter, faster and better looking than most people.


Post a reply to this message

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