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:

Post by Klasker »

sio2 wrote:Got it working. :D My 32x32 test forest (fully textured) runs at 67fps. 128x128 is ~22fps.

A few notes:
1. Your exe (in the zip) crashes for me. I haven't looked why, yet, as I just dumped the new code in my existing project.
2. I'm using the latest SVN and I get the usual compile errors since the prototype of getMaterial() and getMaterialCount() has changed since 1.2 (s32 to u32). Simple enough to solve, but thought I'd mention it for others to know.
3. The snippet gives untextured trees for me. In my demo I added code to set the bark and leaf textures for each tree instance I make.
4. Also, I think both trees are in the same location in the snippet - I'm sure you'll get "I can only see one tree" postings. :wink: I set the position of each instance in my demo.
1. Mistake on my part. Had some test code I forgot to remove. You can download it again if you want it to work. Only a minor change in main.cpp.
2. Yes, SVN users will have to convert code themselves. Too much hassle in supporting two versions of Irrlicht.
3+4. The point was to demonstrate how to make two trees use the same meshes and leaves. 8)
Another tip: trilinear on the leaf textures helps. The HW blends between mips and makes things look smoother. 8)
I never paid much attention to texture filtering (I always use the default). I tried the trilinear filter and anisotropic one, but didn't notice much of a difference. Probably my video card's fault, though.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

Klasker wrote:3+4. The point was to demonstrate how to make two trees use the same meshes and leaves. 8)
Yep. My only point was that noobs may be scratching their head. :mrgreen:
Klasker wrote:I never paid much attention to texture filtering (I always use the default). I tried the trilinear filter and anisotropic one, but didn't notice much of a difference. Probably my video card's fault, though.
I enable 32bpp and mips after I create my device, so mips are created for all the textures - perhaps your textures aren't mipped?

For me, without trilinear the mips "pop" between mip-levels.
sio2
Competition winner
Posts: 1003
Joined: Thu Sep 21, 2006 5:33 pm
Location: UK

Post by sio2 »

The whole thing is great, but the Tree Generator is solid gold. What's the license on it? I was thinking of something along the lines of making some trees and saving them to disk to preprocess them (for some stuff HW instancing and HW point-sprites). I shall call them Klasker Trees, anyway. :D
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

sio2 wrote:The whole thing is great, but the Tree Generator is solid gold. What's the license on it? I was thinking of something along the lines of making some trees and saving them to disk to preprocess them (for some stuff HW instancing and HW point-sprites). I shall call them Klasker Trees, anyway. :D
It is not under any license at the moment (though common laws still apply). I was thinking of putting it under the zlib license, which seems a very reasonable license.
lordcool
Posts: 15
Joined: Thu Jul 13, 2006 8:33 am

Post by lordcool »

i found some strange thing.
use Maya Camera scene node.
rotate up to tree top and see down. and then leaves are disappearing.
see,
http://hompy.ollio.com/view.asp?fnm=hompy168400.jpg
Last edited by lordcool on Mon Feb 26, 2007 3:52 pm, edited 1 time in total.
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

lordcool wrote:i found some strange thing.
use Maya Camera scene node.
rotate up to tree top and see down. and then leaves are disapearing.
see,
http://hompy.ollio.com/view.asp?fnm=hompy168400.jpg
The link leads me to a site with Japanese or Korean letters, but no image.
lordcool
Posts: 15
Joined: Thu Jul 13, 2006 8:33 am

Post by lordcool »

The link leads me to a site with Japanese or Korean letters, but no image.
I'm from Korea. I love this cool tree. see another link,
Image
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

I looked at the Maya camera source, and it seems it doesn't bother to update its absolute matrix properly (no rotation is set). That means the leaves don't know how to render properly. Keeping secrets is a very uncooperative behavior from a scene node, especially from a camera, so I wouldn't recommend using the Maya camera.

The Maya camera is officially incompatible with the leaf billboards.
drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

Klasker damn you do good work. I really like these trees. I hope you licence under zlib or BSD or something :)
If you want a readme or something with the code and textures just let me know :0

One small bug to report. Rotating the CTreeSceneNode does not rotate the leaves with the trunk
Image
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

Klasker damn you do good work. I really like these trees. I hope you licence under zlib or BSD or something Smile
If you want a readme or something with the code and textures just let me know :0

One small bug to report. Rotating the CTreeSceneNode does not rotate the leaves with the trunk
Found and fixed the bug. Thanks for reporting it. Download version 2.1a.
drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

umm the download 2.1a is missing CBillboardGroupSceneNode.cpp
the other files compare exactly with previous version
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

drac_gd wrote:umm the download 2.1a is missing CBillboardGroupSceneNode.cpp
the other files compare exactly with previous version
maybe he included it by mistake?
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

GRRR... Download it again.
drac_gd
Posts: 132
Joined: Sun Apr 09, 2006 8:43 pm

Post by drac_gd »

the new code in ver 2.1a didn't fix the rotation issue. I am not sure if it is truely a bug in your code or because I have changed things in the prerender/postrender of my local version of irrlicht.

Here is a fix that seams to work in my case

Code: Select all

void CBillboardGroupSceneNode::updateBillboards()
{
	this->updateAbsolutePosition(); // add this line so billboard group position/rotation is updated before calculations
    ICameraSceneNode* camera = SceneManager->getActiveCamera();
    
    if ( !camera )
        return;
seems to be working now :)
Klasker
Posts: 230
Joined: Thu May 20, 2004 8:53 am
Contact:

Post by Klasker »

the new code in ver 2.1a didn't fix the rotation issue. I am not sure if it is truely a bug in your code or because I have changed things in the prerender/postrender of my local version of irrlicht.
Hehe, the absolute matrix being updated at post render rather than pre render is one of Irrlicht's more dreaded features. If your fix works for you then go for it; I'm keeping the code loyal to Irrlicht traditions, though. ISceneNode decides when to update the absolute transformation, and if that happens to be post render, then my trees will use post render. 8)
Post Reply