GeoMipMapped Terrain Scene Node ( UPDATED 3/3/05 )

A forum to store posts deemed exceptionally wise and useful
Post Reply
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

GeoMipMapped Terrain Scene Node ( UPDATED 3/3/05 )

Post by Spintz »

Because there are so many changes still going on with this scene node, it's become too much for me to keep updating the how-to's. Once the scene node closer to be finished and much more refined, I'll put the how-to's back up.

In the meantime, just go to -

http://irrlicht.spintz.com

- to keep up to date with changes and to download the newest source code which has the complete engine.
Last edited by Spintz on Fri Mar 04, 2005 1:00 pm, edited 27 times in total.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Now, here's some code to implement the CGeoMipMapSceneNode with a TriangleSelector!!!

Code: Select all

scene::IGeoMipMapSceneNode* mipmap = smgr->addGeoMipMapSceneNode ( 0, -1, 5, 17,
	core::vector3df ( 0.0f, 0.0f, 0.0f ), core::vector3df ( 0.0f, 0.0f, 0.0f ), 
	core::vector3df ( 100.0f, 0.0f, 100.0f ) );
mipmap->LoadHeightMap ( "freeworld04.bmp" );
mipmap->setMaterialTexture ( 0, driver->getTexture ( "grassdetail.bmp" ) );
mipmap->setMaterialTexture ( 1, driver->getTexture ( "freeworld04_lightmap.bmp" ) );
mipmap->setMaterialFlag ( video::EMF_LIGHTING, false );
mipmap->setMaterialFlag ( video::EMF_WIREFRAME, true );
mipmap->setMaterialType ( video::EMT_LIGHTMAP );

scene::ITriangleSelector* selector;
selector = smgr->createTriangleSelector ( mipmap );
mipmap->setTriangleSelector ( selector );
selector->drop ( );
That's it.
Constructor arguments -
1st - parent node ( never made this a child of another node, no clue what'll happen there )
2nd - id
3rd - MaxLOD ( going higher than 5 doesn't work right, still working on that )
4th - PatchSize ( the patch size needs to be a a value in the form 2^n+1, like 5, 9, 17, 33, 65, etc. )
5th - Position of the node
6th - Rotation of the node ( not implemented yet )
7th - Scale of the node.

If you're getting low FPS, try playing with the patchsize. The MaxLOD should be fine at 4 or 5. I recommend 5, been working great for me.
Last edited by Spintz on Fri Jan 21, 2005 8:06 pm, edited 3 times in total.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

So has anyone even tried out that sample EXE i made for download?

What FPS's are you guys getting?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

All this is now covered on the webpage I made -

link is http://www.spintz.com/irrlicht/geomipmapscenenode
Last edited by Spintz on Wed Jan 19, 2005 9:25 pm, edited 1 time in total.
Guest

Post by Guest »

Can't wait to try this but CGeoMipMapSceneNode.cpp is down :(
Guest

Post by Guest »

I found that the problem is you are linking it as such: CGep]/b]MipMapSceneNode.cpp
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Yah, link fixed, sorry bout that.
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Alright, cool Spintz. I have tried converting this as I said to NX++ but I get these errors:

c:\nx++\nx++-devel\include\nx++\IUnknown.h(42) : error C2470: 'IUnknown' : looks like a function definition, but there is no formal parameter list; skipping apparent body
c:\nx++\nx++-devel\include\nx++\vector3d.h(20) : error C2146: syntax error : missing ';' before identifier 'vector3d'
c:\nx++\nx++-devel\include\nx++\vector3d.h(20) : fatal error C1075: end of file found before the left brace '{' at 'c:\nx++\nx++-devel\include\nx++\vector3d.h(20)' was matched


Any idea what those are about?
G'Day.
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Nevermind, mm765 helped me, and in-turn actually added it to the NX++ engine :).
G'Day.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Cool about adding it to the NX++ engine, can't wait to see it working there and compare the performance.

I've made some major changes to make it run and load faster, refer to first post. I've loaded a 49MB ( 4096x4096 ) heightmap in a little over 6 seconds and get over 50 FPS viewing the terrain as well!!!! :shock:
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

A new sample application -

EDIT: Links fixed! Sorry! :oops:

http://www.spintz.com/irrlicht/geomipma ... estExe.zip
http://www.spintz.com/irrlicht/geomipma ... estExe.rar

To increase FPS, close the Patch Visible Window ( it takes a lot of processing to show this info, but I'm using it for debugging the view frustrum culling I'm doing, and it's kinda neat to see how well the new algorithm i'm using is working )

* [F1] toggles the debug window
* [F2] toggles the patch visible window
* [1] makes wireframe
* [2] makes textured
* [~] takes screenshot ( screenshots are saved in the local directory, you can take as many as you'd like, they create a new filename each time you take one )

The sample heightmap is 512x512. You can select DirectX 8 or 9 or OpenGL, the software renderer will not work with this with my engine ( I haven't updated code to the software renderer ).

I'd like some people to download and test this, so I can get an idea of how well the algorithm is working on different machines! Thanks in advance! :)

Tomorrow, I'll put together my Irrlicht modified source and the source for this sample application, so people can mess around with the code themselves. I'd like to see how it performs on Linux machines as well! :) And I'm really looking forward to some screenshots of other peoples terrains with this scene node, I think it's very, very promising! :)

Here's a screenshot of this demo application -

Image
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Works great for me, I will post more data/performance tomorrow, but its awesome. Thanks for the great work and keep it up man! Cant wait to see quad-tree culling!
G'Day.
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Compile Error

Post by deprecated »

The changes to CSceneManager.cpp code on Spintz website is incorrect.. it should read as follows..

After the implementation of the addTerrainSceneNode function, add -

Code: Select all

    //! Adds a geomipmapped scene node to the scene graph.
    IGeoMipMapSceneNode* CSceneManager::addGeoMipMapSceneNode(
            ISceneNode* parent, s32 id, s32 maxLOD, s32 patchSize,
            const core::vector3df& position, const core::vector3df& rotation,
            const core::vector3df& scale )
    {
            if ( !parent )
                    parent = this;

            CGeoMipMapSceneNode* node = new CGeoMipMapSceneNode ( parent, this, id,
                    maxLOD, patchSize, position, rotation, scale );

            return node;
    }
Changes to Code:
deleted the ")" replace with ","
added "rotation,"

Compiles clean now!

p.s... should have a linux screenshot later today!

Nice code Spintz!

:P
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Fixed that typo, thanks! :)
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Post by deprecated »

Hey Spintz,


I followed all the intructions, added the new class files to my makefile, compliled modified irrlicht lib....

Now, I keep getting this error when I try to add the node and compile my program...

Code: Select all

IGeoMipMapSceneNode' undeclared in namespace `irr::scene'
just like it doesn't exist... what am I doing wrong?

I must be overlooking something... do you have any ideas?

ps.. using linux
Post Reply