Best way to make ground

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
PeterWelzien
Posts: 6
Joined: Thu Mar 20, 2008 9:04 am
Location: Sweden

Best way to make ground

Post by PeterWelzien »

Hi. I'm working on a car game where you drive around in a city (like GTA). I'm wondering which way is the best to create the ground. Using a terrain node with a flat heightmap, a hills plane mesh with no hills or just a very big and very thin box.
/Peter Welzien
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

If you use a hill plane mesh then consider how many tiles you need in it. You probably only need a very large quad, so 1 tile (though very large quads can be inefficient for rendering, at least on PS3 this is true, i shouldn't think it's limited just to that and probably applies to PC as well).

So i'm not sure what would be best, i suggest you experiment. Try out each of the suggestions you made, though a box probably isn't worthwhile as that's definetly got more polygons in it than you need, so i guess a hill plane mesh with 1 tile is better than the box. So a flat heightmap, a hill plane mesh with a single tile and a hill plane mesh with more tiles. Then see which gives the best framerate.

Also it depends how you want to texture the ground i guess... If you've just got a hill plane mesh with one tile then you can just have a texture on it, un-repeated. So if it's a really big quad you'd probably get a very bad quality result as the texture would be stretched over it all. If you have multiple tiles then you can repeat the same texture which would give you a better quality result.
Image Image Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

You can also repeat the texture on a 1-tile hillplane. Simply change the texture coords or use the texture matrix. 1 tile will result in very bad shading, though, and a strong seam in the middle where the two triangles meet. However, driving around on a flat plane is also not so interesting, so you might want hills?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

If you really want to emulate GTA, then I wouldn't bother with a hill plane.

I'd just use the same geometry for the ground and buildings, as you'll want to drive on top of buildings and bridges in exactly the same way as you drive on the ground.

For anything remotely similar to GTA, I'd go with a 3d party physics engine.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Fair point!
Image Image Image
PeterWelzien
Posts: 6
Joined: Thu Mar 20, 2008 9:04 am
Location: Sweden

Post by PeterWelzien »

rogerborg wrote:I'd just use the same geometry for the ground and buildings, as you'll want to drive on top of buildings and bridges in exactly the same way as you drive on the ground.

For anything remotely similar to GTA, I'd go with a 3d party physics engine.
I'm a newbie as far as 3D-programming is concerned. I don't really know what you mean by "same geometry". Should I have the ground and all the buildings in one large model? At the moment every building is a different model and I use IrrEdit to place them on the ground and then I just load the scene.

As far as physics engines goes, I'm looking at Newton and True Axis at the moment. They both have a vehicle model. But I haven't had the time to do a thorough comparison of the both and decide on which to use.
/Peter Welzien
PeterWelzien
Posts: 6
Joined: Thu Mar 20, 2008 9:04 am
Location: Sweden

Post by PeterWelzien »

I've made a simple scene in IrrEdit, consisting of a terrain node, a mesh and two lights. It looks ok in IrrEdit, but when I load the scene in my program I don't get any shading.

How it looks in IrrEdit:
Image

How it looks in my program:
Image

I set up the device with the following code:

Code: Select all

SIrrlichtCreationParameters params = SIrrlichtCreationParameters();

params.DriverType = video::EDT_OPENGL;
params.WindowSize = irr::core::dimension2di(1024, 768);
params.Bits = 16;
params.Stencilbuffer = true;
params.Fullscreen = false;
params.Vsync = true;
params.EventReceiver = this;

device=createDeviceEx(params);

driver=device->getVideoDriver();
smgr=device->getSceneManager();
And load the scene with smgr->loadScene(filename);

What am i missing?
/Peter Welzien
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I guess that light attenuation and other things are not stored into the .irr file. Hence, the light is not properly set up in Irrlicht. Try to add a 3d vector attribute to your light nodes in the .irr file named 'Attenuation', with values (0,1/radius, 0). This should restore the old Irrlicht 1.3 values for attenuation.
PeterWelzien
Posts: 6
Joined: Thu Mar 20, 2008 9:04 am
Location: Sweden

Post by PeterWelzien »

It's working. Thanks for the help!
/Peter Welzien
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, I guess it's time for an irrEdit version which uses the final 1.4 SDK...
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Post by suliman »

This is probably what everybody tells you but something similar to GTA is veery hard to do if you're new to this. But if you think its mor fun to learn this stuff while aiming at a very big goal then by all means go for it. Just be prepared that you might not reach it.

There is some projects scattered around this forums that you might look at. I was really overwhelmed when i started with 3d so just stay on track and be prepared that every little thing takes some getting used to:)

Erik
PeterWelzien
Posts: 6
Joined: Thu Mar 20, 2008 9:04 am
Location: Sweden

Post by PeterWelzien »

I've never done any 3D-programming before. Mostly I do this because I think it's fun to learn new things. My intention is not to make a new GTA. I just want to make a small town (just roads and few houses) and a car that I can controll. This will let me learn about both 3D and physics.

When/if I get this working, I might continue and add computer controlled cars or movable objects that you can hit (dustbins, street lights, fences, etc.). And from there maybe continue with more advanced lighting (street lights, car lights, etc.) and shadows.
/Peter Welzien
Post Reply