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

A forum to store posts deemed exceptionally wise and useful
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Post by deprecated »

Spintz: Lets see.. how about the "real world" coords. That would be easiest...

I looks like you have made a bit of progress...

Well, I can see that I need to start working a little harder on my game.. so I can announce it to everyone... Just a small hint: "even better than the history channel..."


On GeoMorphing: I hear ya... I saw the popping while the LOD changes... it reminded me of the old school games, the first helocopter games with terrain...
(excempt they had like only 4 triagles on the screen at times...)

Newest Screenshot:
Very nice, I see that the detailed map is working nicely. There are mountains and grass in the appropriate areas... very nice...

It would be possible with your new engine code, to dig a hole and put a dirt texture in/around the hole?

Thanks for all your time/help!
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

It would be possible with your new engine code, to dig a hole and put a dirt texture in/around the hole?
That would be tough. What i've done isn't actually detail mapping. I used FreeWorld3D to generate the terrain and T2 to generate the texture and lightmap, it's actually a single texture spread across the whole terrain.

T2 lets you scale a texture, similar to planar texturing and you can scale each individual layer you create. FreeWorld3D does as well, I just like the T2 interface for that better, but FreeWorld3D has great terrain editing tools.

So anyways, to be able to apply a new texture to that modified terrain, would be tough. What that would require is multiple pass rendering in the engine, so that you could dynamically update the texture of the terrain as the elevation of vertices changed, by providing texture layers and alpha blending them, etc. I've been looking into it, but I don't want to slow it down too much, so I'm being careful on how to implement and I think to get any of those advanced texture features in, I need to completely re-write the algorithm to support quad trees. I have an idea for a completely new algorithm based on quad trees, CLOD and geomorphing, with a little twist, that that I haven't seen before, gonna be a while on that though, to get it right.

For now, just deforming the terrain will be easily possible, once I get these other basic things done, I'll put that in, then work on revamping the algorithm for quad tree rendering. ;)
Image
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Probably won't get the new update out till sometime this weekend. I'm putting in major updates to the geomipmaptriangleselector, similar to the octtree triangle selector, except it initializes much faster, and it also will have the functionality to return triangles very quickly based on the patches.

I really want to get it in, because it will increase the speed by A LOT, when using a triangle selector with a large terrain. Sorry for the delay! :(
Image
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Post by deprecated »

Time is money! *the sound of a whip cracking in the background*

:D
Now, back to reality...

You many already know it, but I think I speak for everyone here, we all thank you for your hard work!

This is greatly improving the abilities of the engine...

Also, your clean code might just be scooped up by niko... that would make it worth it...

Edit: ok, so ignore this if it doesn't help, but I found this website while trying to get a better understanding of quadtree and such... not much good to me right now.. but maybe will help you...
http://home.planet.nl/~monstrous/
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Just updated the code, much, much better version, IMO. In short, I've added the AtmosphereSceneNode and GREATLY improved the triangle selector and made optimations to generating the indices. Here's the change notes for this release -

> Added the CAtmosphereSceneNode class. This node uses a sky plane to display the sky and will eventually have more modifications, like multiple layers. The node can also automatically rotate based on a degree per second rotation.
> Put in a small fix to the CCameraFPSSceneNode. It makes the camera a lot smoother and more responsive.
> Re-created the .chm file for the entire Irrlicht engine, not just the GeoMipMapSceneNode and GeoMipMapTriangleSelector. Also began fixing documentation errors throughout the code.
> Greatly increased the performance of the GeoMipMapTriangleSelector. The selector now stores the triangles based on the patches in the GeoMipMapSceneNode. The functions to get triangles from a line and from a bounding box now return only the triangles that are in the patch the line or bounding box intersects with. It is now more efficient to create the selector with the highest LOD ( 0 ) and turn off the dynamic update of the selector!!!
> Optimized the way indices are generated and stored by minimizing resizing of the GeoMipMapSceneNode's index buffer.
> Small optimization in the getCollisionPoint function in the CSceneCollisionManager class. It now stops looking for triangles when it's found an intersection.
> Changed the GeoMipMapSceneNode to use S3DVertex2TCoords. This allows for proper texture scaling of only the base texture, not the lightmap texture. It also fixed problems where lightmaps were not properly rendered. The node now works with makePlanarTextureMapping, however, I've added a function called ScaleTexture which does a better job of scaling the texture. The makePlanarTextureMapping function was producing weird texturing, will look into that problem in a later release, but I believe the problem is that it uses normals for calculating the texture changes and normals are not reliable in this scene node as vertices are constantly taken in/out of the render.
> Added a keycode for the ` key.

http://irrlicht.spintz.com/geomipmapscenenode

Thanks deprecated, i'll take a look at the website.

EDIT: Yeah, that terrain code on that site does quad tree rendering. I think the GeoMipMapping is faster. I'm looking at a way to kind of mix the technologies, like filtering vertices that the geomipmapping code needs to consider with q rough quad tree, implementation. This will help mostly by greatly lowering the number of vertices sent to the GPU with the drawPrimitive calls. But any code/suggestions/references can help! ;)
Image
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Post by deprecated »

New feedback:

New engine gives me seg fault.... I used basic example below...

The addGeoMipMapSceneNode is where I crash at.. I will run debug in the morning and see what it has to say... heightmap is 64x64...

Code: Select all

#include <irrlicht.h>
using namespace irr;
#pragma comment(lib, "Irrlicht.lib")

int main()
{
  IrrlichtDevice *device =
      createDevice(video::EDT_OPENGL, core::dimension2d<s32>(800, 600),32);
   video::IVideoDriver* driver = device->getVideoDriver();
   scene::ISceneManager* smgr = device->getSceneManager();
   scene::IGeoMipMapSceneNode *node = smgr->addGeoMipMapSceneNode(0,-1,5,scene::EPS_17,
      core::vector3df ( 0.0f, 0.0f, 0.0f ),
      core::vector3df ( 0.0f, 0.0f, 0.0f ),
      core::vector3df ( 1.0f, 1.0f, 1.0f ));

   node->LoadHeightMap("../../media/freeworld04.bmp");
  //node->setMaterialTexture(0,driver->getTexture("../../media/grassdetail.bmp"));
//node->setMaterialTexture(1,driver->getTexture("../../media/freeworld04_lightmap.bmp"));

   //node->setMaterialFlag(video::EMF_LIGHTING,false);
   node->setMaterialFlag(video::EMF_WIREFRAME,true);
  // node->setMaterialType(video::EMT_LIGHTMAP);

  // scene::ITriangleSelector *selector = smgr->createTriangleSelector(node,0);
  // node->setTriangleSelector(selector);
  // selector->drop();

   scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS();
   device->setWindowCaption(L"GeoMipMap Test");

   while(device->run())
   {
      driver->beginScene(true, true, video::SColor(0,0,0,0));
      smgr->drawAll();
      driver->endScene();
   }

   device->drop();

   return 0;
}
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Forgot to mention, there are 2 new files you need to add to your makefile for Linux, CAtmosphereSceneNode.h and .cpp. Maybe this is causing the problem?
Image
deprecated
Posts: 62
Joined: Fri Jan 07, 2005 4:37 pm
Location: California

Post by deprecated »

I have already added CAtmosphereSceneNode...

Other progs still run fine... Just seems to be when I call the addGeoMipMapSceneNode..

Have you changed the params er does the code samlpe I posted look legit?

EDIT:

I ran debug and it seems to die on calling GeoMipMapSceneNode::OnPreRender()

EDIT#2:

Ah ha... That was easy enough... Looks like the camera must be created before the addGeoMipmapSceneNode is called... Cause prerender looks for camera to do all the fancy stuff, right?.. works now... thanks for help...
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Ahh, yeah, that's it, I guess, I should check that pointer and if the camera does not exist, not do anything, thanks for the bug report :)

EDIT: Ok, that's fixed, tomorrow I should have another update, it makes a very nice improvement on the rendering speed. Instead of passing all vertices and a list of indices to drawPrimitive, I know add the vertices to be drawn to a RenderBuffer and the indices are basically always { 0,1,2,3,4,5,6,7,8,9,10,11.... }. On my slow, P4 1.7 with GF4 TI4600, I'm getting over 80 FPS on a 1025x1025 heightmap now!! :)

This is also the first step to allow for separate materials/textures for each patch. :)
Image
NCZ

Post by NCZ »

:wink: YOUR SCENENODE IS COOL,

is it possible or is it already
available to ur scenenode the ff. enkx.

HOW TO OR EXAMPLE OF:

A). Getting the terrain POSITION3d from MOUSE POSITION2D
in the easiest and fastest way.

e.g. terrainPos3D = GetTerrainPos( myTerrain , mousePos2d )

B.) Get the the Height of terrain from POSITION3d, x,y

e.g. TerrainHieght = GetTerrainHeight( myTerrain, terrainPos3D )

If i can get the the MOUSE coordinate in TERRAIN in the fastest way
and i can get the HEIGHT ot the terrain i can easily set the HEIGHT
position of my player.

MyPlayer->SetPosition( PlayerPosX, TerrainHieght , PlayerPosY)


a complete example or tutorial will be very much appreciated
enks in advance ..

sorry 4 my bad english...
Deadpoet

GeoMipmap on already loaded mesh

Post by Deadpoet »

Hi
GeoMipmap node is great :D Thanks for value addition and making MOD too.. it was so simple to do all . 8)

Is it possible to give geomipmaping on regular grid which is already loaded
like 3ds file.etc.
NCZ

Post by NCZ »

On my previous question : " how to get the hieght"

"getCollisionPoint" do the trick, problem solved.

:D
Just Mike

Post by Just Mike »

Is there a demo for this?
kaeles-notlogged

Post by kaeles-notlogged »

i think he meant retrieveing the hieght without having to do collision for example....
if you wanted to hieght to place vegetation (also using a texture to place them) like a vegetation map....
i was looking into this, then i decided to take calc and 3 junior level classes this semester (im a freshman... kinda) hahahah
anyways, this scenenode is very nice, thanks alot spintz
madoc

Texture Loading in jan29th release

Post by madoc »

I took his base release, and merged in a lot of tweaks and extensions I had made. Now none of my changes even touch the renderers, or the texture loading or any of the low level stuff. Its mostly adding functionality to the UI system.
So I merged my changes into his, with a few minor problems, mostly with changes I made that I forgot to merge, and them being depended on by other changes:)
I'm now at the point where I'm relinking my actual projects with this altered version of the dll.
The problem I'm having is that texture loading seems...completly dead.
I'm using a 24bit bitmap image.
No errors, the debug stuff from irrlicht dosnt complain or anything, just...its as if the texture isnt being loaded. Wondering if anyone else has the same problem or if its just me. I'm done playing with this for tonite. Tommorow I'll try compileing a fresh copy of his code, and linking my programs against it and see if thats still a problem.
Just wondering if anyone else has run into this.
Post Reply