Page 5 of 16

Posted: Fri Dec 08, 2006 12:32 am
by lug
Thanks, Klasker! I'm going to try it out when I get home from work!

I don't remember but does it play well with physics? Like say using newton to simulate wind and deforming parts of the tree, breaking branches, knocking off leaves, seeing leaves fall off tree, etc all realistically through physics?

I saw the tree falling over and splitting apart in the crysis video. I immediately thought about your tree and whether it can be done with something like newton behind it.

It looks like bullet has support for sending the physics stuff to a gpu. So, in the future we can do physics through:

1. multi-core cpu

2. 3d graphic card gpu or
multi-core gpu

3. physic processor card or
multi-core ppu

Gosh, so many different ways to go with physics what a programmer to do? :)

Posted: Fri Dec 08, 2006 2:18 pm
by Klasker
The trunk itself cannot be deformed, since the tree skeleton is not exposed. The code for animations wouldn't be too complicated, but it would consume more CPU, which I don't like. Deforming it on the GPU is not a good idea, since it relies on skeletal animation. I will look into it for the next release, though.

Breaking off leaves and branches sounds cool, but I think it is overkill. I can think of ways to do this, but it involves a lot of work not really related to trees.

I am developing this with computer games in mind, and good frame rates are more important to me than über-realistic physics.

I guess the short answer is: No. It does not play well with physics. The leaves can be animated, but that's it.

Posted: Tue Dec 19, 2006 10:12 am
by krama757
Great job on this Klasker! I am currently working on making a small scene builder for my game that includes your trees and bit's grass nodes :)

Wish me luck!

Update!

Posted: Sun Feb 18, 2007 10:32 am
by Klasker
Update!

Complete rewrite of the code (again) - this time it loads tree designs from XML files, leaves are now billboards, and four tree designs are included in the download. This version is officially called version 2.0.

The full feature list:
  • 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 (2.89 MB)

Posted: Sun Feb 18, 2007 11:43 am
by drac_gd
I just gotta say WOW.
These are really looking sweet. Thats some kick ass code you've written. and thanks for open sourcing it :D

Posted: Sun Feb 18, 2007 11:58 am
by Virion
so how to import the trees into the irrlicht application?

Posted: Sun Feb 18, 2007 11:59 am
by BlindSide
Wow that truly looks awesome.

Posted: Sun Feb 18, 2007 12:12 pm
by sio2
I predict a demo coming up. I have some terrain with grass - would look nice with trees. :wink:

Hmmm. I have: Klasker trees; reflective water; my grass stuff (not yet released); and (fake) HDR. Yes, I definitely predict some eye-candy. Maybe I could add a deer with fur...

Posted: Sun Feb 18, 2007 12:31 pm
by BlindSide
sio2 wrote:Maybe I could add a deer with fur...
:lol: That sounds very nice...

Klasker, I saw on an Ogre project they use 8 directional imposters. Basically the billboard image changes depending on the direction it is viewed from. I know that is not really part of your project as you already said before. But maybe something more complex like this will catch your interest? (I wonder if you can generate these images on the fly, too?) (Maybe render inside a blackbox from 8 different directions and use the screenshots as textures?)

PS: Here is link to the Ogre thing it might help you steal some ideas :D
http://www.ogre3d.org/phpBB2/viewtopic.php?t=24918

Posted: Sun Feb 18, 2007 12:56 pm
by dawasw
Excellent work Klasker :D I'm definately going to use it now. :)

Posted: Sun Feb 18, 2007 2:26 pm
by Klasker
I finished the description of the XML format I use for the tree designs, so if anyone is interested you can read it here.
Virion wrote:so how to import the trees into the irrlicht application?
Try looking at the demo program included (main.cpp). Very simple, you can do it like this:

Code: Select all

scene::CTreeGenerator* oakGenerator = new scene::CTreeGenerator( manager );

io::IXMLReader* xml = device->getFileSystem()->createXMLReader( trees/Oak.xml" );
oakGenerator->loadFromXML( xml );
xml->drop();

scene::CTreeSceneNode* tree = new scene::CTreeSceneNode( manager->getRootSceneNode(), manager );
tree->drop();

tree->setup( oakGenerator );
Klasker, I saw on an Ogre project they use 8 directional imposters. Basically the billboard image changes depending on the direction it is viewed from. I know that is not really part of your project as you already said before. But maybe something more complex like this will catch your interest? (I wonder if you can generate these images on the fly, too?) (Maybe render inside a blackbox from 8 different directions and use the screenshots as textures?)
Every tree from the same tree design uses the same billboard texture. I don't want to litter up the video card's memory by having 8 textures PER TREE stored there. That would literally kill the video card in a forest. Unless I misunderstood what you meant. If more variation is required, it is possible to give the tree node different billboard textures, so they don't all look identical.

Posted: Mon Feb 19, 2007 11:37 am
by BlindSide
Not PER TREE, but 8 for every tree, for every direction. That is if most of the trees look enough alike. Please have a look at the link I provided for more detailed information.

Cheers :D

PS: You are awesome for making this and also your extended text :D

Posted: Fri Feb 23, 2007 3:48 am
by drac_gd
Klasker,
Do you have a logo? I am planning to use your trees in my project

here is my current image .. Is this OK?
Image

Posted: Fri Feb 23, 2007 7:35 am
by Klasker
Wow, time to make a logo 8)

Here you are:
Image

Yet another shameless ripoff of Irrlicht's logo :D The trees are still free software so you don't have to display the logo, but it's always nice to get credit :wink:

Posted: Fri Feb 23, 2007 10:42 am
by bitplane
wow, very cool.. nice to see the progression over time! I wish I had time to develop my toys to this level of depth.
nice work!