Tree Scene Node v2.1

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
etcaptor
Posts: 871
Joined: Fri Apr 09, 2004 10:32 pm
Location: Valhalla
Contact:

Post by etcaptor »

Great work again!
I saw that CLODSceneNodeAnimator is not distributed with last update. Now when leaves are supported maybe this animator can treat branches and leaves by different way - apply LOD to branches, but keep leaves visible, so when camera is far, tree will look with lives, despite LOD of branches.
ImageImage
Site development -Rock and metal online
--- etcaptor.com ------freenetlife.com
Amarth
Posts: 4
Joined: Tue Apr 18, 2006 9:00 pm

Post by Amarth »

Doesn't compile here...

Code: Select all

CTreeSceneNode.cpp
.\CTreeSceneNode.cpp(361) : error C2057: expected constant expression
.\CTreeSceneNode.cpp(361) : error C2466: cannot allocate an array of constant size 0
.\CTreeSceneNode.cpp(361) : error C2133: 'directions' : unknown size
That's on the line

Code: Select all

core::vector3df directions[radVerts];
Using VC++ 2005 Express. I could probably get this working using either resizable stl vectors or some pointer arithmetic, but perhaps someone else has a better idea :).

Hope I can get this solved, the demo looks very promising...
Yeurl
Posts: 31
Joined: Thu Apr 13, 2006 9:34 am

Post by Yeurl »

Klasker, can i have a picture of you ... you are my GOD !!!

exelent work ;)
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

I saw that CLODSceneNodeAnimator is not distributed with last update. Now when leaves are supported maybe this animator can treat branches and leaves by different way - apply LOD to branches, but keep leaves visible, so when camera is far, tree will look with lives, despite LOD of branches.
Not possible at the moment. The tree only generates itself exactly when it needs to, so if it is LOD 1, the leaf positions for LOD 4 are still unknown. I did this to maximize performance as I'm fighting a war to keep my FPS high.
I'll include CLODSceneNodeAnimator in the zip when I get home, thanks for letting me know. It has been updated by the way, now supports linear interpolation, quadratic interpolation and constant interpolation.
Using VC++ 2005 Express. I could probably get this working using either resizable stl vectors or some pointer arithmetic, but perhaps someone else has a better idea Smile.
Hmm.. I thought local arrays of variable size were supported by all compilers. Guess not.
You should be able to fix it easily like this:

Code: Select all

core::array<core::vector3df> directions;
directions.set_used( radVerts );
Klasker, can i have a picture of you ...
Uhm.. no? 8)
Amarth
Posts: 4
Joined: Tue Apr 18, 2006 9:00 pm

Post by Amarth »

Klasker wrote:Hmm.. I thought local arrays of variable size were supported by all compilers. Guess not.
You should be able to fix it easily like this:

Code: Select all

core::array<core::vector3df> directions;
directions.set_used( radVerts );
Yes, that did it. Well, thanks a lot for this piece of code, it's beautiful!
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

simply amazing! :shock: :shock:

and I like those names...klasktrees/bitgrass, heheheh they even sound commercial. :wink:
puh
Posts: 356
Joined: Tue Aug 26, 2003 3:53 pm

Post by puh »

Klasker, i think would be interesting for you to look into competitors, like this:
http://www.frecle.net/treed/ (this is free tree generator addon for gile[s]), you can get new ideas of tree with leafs creating method (with less triangles)...
Here is screen:
Image
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

Small update again. Generating trees should now be much faster due to a small fix suggested by bitplane. Previously it had to copy the whole vertex array every time a branch was generated. It was solved by using push_back instead of set_used (I wrongly assumed set_used would maintain an array size of 2^n).
Even LOD 7 trees are now generated instantly! :D
VC++ should now be able to compile it without problems (see Amarth's issue in a previous post).

Download (1.11 MB)
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

.net version?

Post by buhatkj »

this is pretty darn awesome. would anyone object if I tried to port it to .NET?? I couldn't seem to find any reference to how you wanted this licensed...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

would anyone object if I tried to port it to .NET?? I couldn't seem to find any reference to how you wanted this licensed...
Not at all, go ahead. There isn't really any license, though credit will be appreciated.
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

Update
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
  • Source code rewritten from scratch, again.
  • CTreeSceneNode no longer exists. Instead there is a CTreeGenerator that returns a mesh for you to display.
  • You can now design your own type of trees by implementing ITreeProfile. Or you can use CStandardTreeProfile and CPineTreeProfile which I have written.
  • Uses an ILODMesh interface based on IMesh, to support continous LOD without breaking Irrlicht's interface.
  • Unfortunately, there are a lot of files now. 21 files now. Used to be 10.
  • Download (1608 KB) source and demo application.
  • See all screenshots. Pine trees can be seen below.
ImageImage
ImageImage
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

Woha! Pretty impressive.
juliusctw
Posts: 392
Joined: Fri Apr 21, 2006 6:56 am
Contact:

Niko are you thinking of adding this into irrlicht

Post by juliusctw »

Niko are you thinking of adding this into irrlicht?
juliusctw
Posts: 392
Joined: Fri Apr 21, 2006 6:56 am
Contact:

Great job :)

Post by juliusctw »

Hello

I have in coporated your code into mine, it works great, I do have a wish list, i don´t know if its too early to start..

i would be great if you can pass in the ISceneNode (the camera for example) , depending on the location of the Iscenenode to the tree, the LOD will change automatically. Also , if the distance if far enough, i think we can still show the whole tree by simply showing a picture that rotates perpendicular with the character, as the character walk closer it would then switch to the tree you have.

I really need to do something like this for my own game, i'll be willing to modify your code myself... but perhaps you already have something like this going on.

thanks
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

i would be great if you can pass in the ISceneNode (the camera for example) , depending on the location of the Iscenenode to the tree, the LOD will change automatically.
Did you look at the source? Try and see the CLODSceneNodeAnimator. Right now it does exactly that, only that it only does it for the active camera. If you want it to use an arbitrary node it's a very easy fix, though.
Also , if the distance if far enough, i think we can still show the whole tree by simply showing a picture that rotates perpendicular with the character, as the character walk closer it would then switch to the tree you have.
My code is for generating the trees models. Making it change to billboards is easy, but it has nothing to do with trees. Rocks, houses, humans, castles, etc, are also worth turning into billboards at a fair distance. I could write it, but I don't see why you would expect it in a thread about trees. Afterall, this is not "ACME Forest Creation Kit™".
I really need to do something like this for my own game, i'll be willing to modify your code myself...
My code is completely independant of what you want to implement. The ILODMesh and ILODSceneNode might need a new virtual method or two depending on your approach, but you really shouldn't touch the tree generation itself.
Post Reply