Page 1 of 16

Tree Scene Node v2.1

Posted: Mon Jan 16, 2006 1:54 pm
by Klasker
This is a pseudo-random tree generator I made for Irrlicht. It loads a tree design from an XML file and creates a mesh representation of the tree using a seed for random numbers.

The current version is 2.1. This post has been edited to fit the newest version.

Current features:
  • Loads tree designs from XML files.
  • Four tree designs included: Oak, Pine, Aspen and Willow.
  • Leaves are now billboards. Looks a lot better.
  • Leaves can have variable vertex colors (defined in the XML file). Very effective.
  • Shadows can be emulated by darkening those leaves on the side of the tree facing away from the light source.
  • The automatic LOD has been revamped. The old method was not very good. Trees now have three levels of detail:
    1. Full detail
    2. Low detail : Radial segments reduced to 4, highest branches are cut.
    3. Billboard : Tree becomes a billboard.
  • Trees can be scaled and rotated without breaking (mostly the billboard leaves were problematic here). This is useful for water reflections.
  • Note that wind is no longer supported. I will work on this.
Screenshots:
ImageImageImageImage

I have made an effort to make it a lot more usable than last time. This means that there are only 6 files now (3 headers and 3 sources), and the LOD looks a lot better now (it used to look rather hopeless).

Download (3.11 MB) | XML Tree Design Format | shogun's IrrEdit Plugin

Posted: Mon Jan 16, 2006 2:02 pm
by Conquistador
Brilliant!

Posted: Mon Jan 16, 2006 2:05 pm
by ry
looks great, keep up the good work

Posted: Mon Jan 16, 2006 4:11 pm
by etcaptor
Great!
This is another great addition for Irrlicht users.
Just some ideas in addition:
- maybe will be good to placing leaves and related functions in CTreeSceneNode class. Leaves can be created like child nodes.
- Several types for leaves - it's easy to implement and gives more realistic look.

Thanks.

Posted: Mon Jan 16, 2006 5:15 pm
by Klasker
Thanks for the comments.

In the program, you can press F8 to toggle leaves on/off. There is a method for placing leaves:

Code: Select all

const core::array<core::vector3df>& getLeafPoints() const
That way, it is up to the user how to render the leaves.

I forgot to take a screenshot of the leaves in my first post (doh!), but as you can see, you didn't miss out on much - my leaves stink.
Image
But the point is that the leaves can be rendered differently without touching the tree source code - which is a nice separation imo.

Posted: Sat Apr 15, 2006 4:07 pm
by Klasker
Update: LOD

Trees now support continous level of detail. On the downside, I have removed support for leaves for now. I will develop some pretty leaves later.

It also uses a random seed for reproducible behaviour. Using the same seed twice will generate the same tree twice.

Here is a quick screenie of a tree in various levels of detail.
Image Image
Image

The demo program is almost the same as before, but you can download it here including the source:
http://www.wc3jass.com/files/Trees.zip

Note: The download also contains a CLODSceneNodeAnimator which is not used in the demo program. You can use it to automatically update the tree's LOD for you, if you decide to use it in a project of your own.

Posted: Sat Apr 15, 2006 6:36 pm
by puh
Nice work, Klasker! Thank you very much, very usefull and clean code.
Would be nice to have better control over branch generation, to get different types of trees, but i'm sure you will develope this project further.
Anyway, LOD animation system is a huge improvement! Keep it up, nice done!
P.S. Now with this cool treenode and nice grass-node we can get a continuous nice-looking terrain, just like in Oblivion ;)

...

Posted: Sat Apr 15, 2006 7:29 pm
by xhrit
what would also be nice is if the trees 'grew' - sorta like unreal's nali fruit, but as simulation, not animation.

There are some good tree growing algorithms on levitated.net - they are in flash but it would not be too hard to reproduce them in a more complex language.

Too bad there are no trees in space - I'll have to wait until I start working on something ground based to use this.

Posted: Sat Apr 15, 2006 9:24 pm
by bitplane
nice work, I love these trees! lets put speedtree out of business! :twisted:
LOD is one step closer to the holy grail - the forrest node ;)

Posted: Sat Apr 15, 2006 10:02 pm
by Spintz
very nice, gonna look at it once i finish backing all my crap up and reformatting so I can dual boot my machine to Fedora Core 5 and WinXP x64.

Posted: Sun Apr 16, 2006 1:32 am
by Klasker
what would also be nice is if the trees 'grew' - sorta like unreal's nali fruit, but as simulation, not animation.
Not sure what you mean but it sounds a bit like overkill. The tree node is meant to be generated in real-time (speed > precision).
P.S. Now with this cool treenode and nice grass-node we can get a continuous nice-looking terrain, just like in Oblivion
LOD is one step closer to the holy grail - the forrest node :wink:
That's exactly what I had in mind. I made this as part of the infinite world game I'm working on.
Would be nice to have better control over branch generation, to get different types of trees, but i'm sure you will develope this project further.
Yeah, I'm planning to do that. But not now :wink:

Edit: Hmm.. posts with multiple quotes seem to look wierd :?

Re: Tree Scene Node

Posted: Sun Apr 16, 2006 10:59 am
by Jesus.Net
Really brilliant: how do you do to see the sheets? :?:

Posted: Sun Apr 16, 2006 10:38 pm
by WhiteNoise
Very cool!

Posted: Mon Apr 17, 2006 11:50 am
by Klasker
Update again. Leaves were less painful than I anticipated, though they are FPS eaters nevertheless.

The leaves support wind, and will use the same IWindGenerator as bitplane's grass, for convenience. The wind is not very realistic, but it's something.

I also made an effort to quicken the process of generating trees, but anything above LOD 6 is still very slow. Takes about 10 seconds to generate an LOD 7 tree. Anything below LOD 6 is still very fast though.

Download: http://www.wc3jass.com/files/Trees.zip

Here is a screenshot of a tree with leaves (much better).
Image

And here is another one with many trees and many leaves ...
Image

Posted: Mon Apr 17, 2006 12:30 pm
by dawasw
OMG!

klaskTREE & bitGRASS (tm)

Great! Just great!