Page 2 of 16

Posted: Mon Apr 17, 2006 7:09 pm
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.

Posted: Tue Apr 18, 2006 9:07 pm
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...

Posted: Tue Apr 18, 2006 11:28 pm
by Yeurl
Klasker, can i have a picture of you ... you are my GOD !!!

exelent work ;)

Posted: Wed Apr 19, 2006 12:30 pm
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)

Posted: Wed Apr 19, 2006 6:26 pm
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!

Posted: Wed Apr 19, 2006 6:47 pm
by afecelis
simply amazing! :shock: :shock:

and I like those names...klasktrees/bitgrass, heheheh they even sound commercial. :wink:

Posted: Sun May 07, 2006 7:59 am
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

Posted: Thu May 11, 2006 4:28 pm
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)

.net version?

Posted: Mon May 15, 2006 4:23 am
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...

Posted: Mon May 15, 2006 10:02 am
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.

Posted: Sat May 20, 2006 6:45 pm
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

Posted: Sun May 21, 2006 1:41 pm
by niko
Woha! Pretty impressive.

Niko are you thinking of adding this into irrlicht

Posted: Sun May 21, 2006 7:54 pm
by juliusctw
Niko are you thinking of adding this into irrlicht?

Great job :)

Posted: Wed May 24, 2006 7:07 pm
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

Posted: Wed May 24, 2006 9:37 pm
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.