Tree Scene Node v2.1

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Tree Scene Node v2.1

Post 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
Last edited by Klasker on Sun Dec 02, 2007 12:42 pm, edited 11 times in total.
Conquistador
Posts: 340
Joined: Wed Sep 28, 2005 4:38 pm
Location: Canada, Eh!

Post by Conquistador »

Brilliant!
Royal Hamilton Light Infantry - http://www.rhli.ca
Paris/Port Dover Pipes'n Drums - http://www.parisdover.ca
ry
Posts: 8
Joined: Mon Dec 12, 2005 4:15 am
Contact:

Post by ry »

looks great, keep up the good work
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post 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.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post 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.
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post 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.
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post 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 ;)
xhrit
Posts: 140
Joined: Mon Jun 14, 2004 8:54 am
Location: earth
Contact:

...

Post 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.
Core2Duo E8400 3.0ghz - 2048mb DDR2 800 - geForce 9600 - Slackware12.1

Word-image-symbol programming limits, controls, and imprisons the individual.
Smash the control images, smash the control machine.
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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 ;)
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post 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.
Image
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post 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 :?
Jesus.Net
Posts: 31
Joined: Sat Apr 15, 2006 6:14 pm
Contact:

Re: Tree Scene Node

Post by Jesus.Net »

Really brilliant: how do you do to see the sheets? :?:
WhiteNoise

Post by WhiteNoise »

Very cool!
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post 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
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post by dawasw »

OMG!

klaskTREE & bitGRASS (tm)

Great! Just great!
Post Reply