Making 3D tile-based terrain?

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
mystic jimbo
Posts: 8
Joined: Fri Oct 13, 2006 3:12 pm

Making 3D tile-based terrain?

Post by mystic jimbo »

Greetings fellow mortals,

I want to make a tile-based 3D terrain in Irrlicht. Terrain would be made of rectangular tiles (each made of two three-pointed vertices). Each such tile could have a specific texture.

It would be great if I could add static lightning on the terrain. By static I mean that lightning does not need to change once the map is made, but I would like to have lightning so that it is easier to tell height variations (hills would have darker and lighter sides).

It would be great if I could tell easily what tile the user has clicked with mouse.

I believe Irrlicht does not support such terrain so I would have to code it myself. Could I code such terrain with Irrlicht and would it make sense (be easy enough)? Should I use some other 3D engine instead?

Thanks for your time.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

Irrlicht has everything you need except the tiled terrain. Lightmaps are provided.

In order to do picking of terrain tiles you would either have to make each tile it's own node, or do some custom picking after you created your tiled terrain node.
Image
mystic jimbo
Posts: 8
Joined: Fri Oct 13, 2006 3:12 pm

Post by mystic jimbo »

Spintz wrote:Irrlicht has everything you need except the tiled terrain. Lightmaps are provided.

In order to do picking of terrain tiles you would either have to make each tile it's own node, or do some custom picking after you created your tiled terrain node.
Citizen Spintz,

Thank you for your advice. Mystic Jimbo much appreciates. I think making each tile a node of its own sounds good.

Would a high number of nodes cause speed issues in itself (if we forget speed issues caused by rendering a good number of vertices)? For example if I had a 100x100 map I would get 10 000 nodes.

How would I go on creating this system? I am all new to Irrlicht and it is a bit hard for me to interpret the docs. Should I make a custom SceneNode like in tutorial number 3?
AmigaIrr
Posts: 94
Joined: Mon Jan 10, 2005 7:55 am
Location: France, Alsace

Post by AmigaIrr »

I think you must only generate visible terrain node (alos for exemple 25*30 tiles) and reaffect the texture on the fly when your move our terrain change...


i have the same problem and want code the same terrain generation as you :D
L'eternité c'est long, surtout vers la fin...

Q6600 triton 79, 4 GO, 2* RAPTOR 150GO of ARECA 256 RAID 0, 3870 Zalmann, P5K. 24" Samsung. Antec nine hundred
mystic jimbo
Posts: 8
Joined: Fri Oct 13, 2006 3:12 pm

Post by mystic jimbo »

Citizen AmigaIrr,

My tiles have height variations, so it is easier for me to keep each tile a node of its own. Irrlicht seems fast enough to handle all the nodes.

Currently I do lights by adjusting vertice colors. Next I'll add some billboards for trees and see how it looks.


Ah, just found out that I can't make them billboards. Will make them child nodes for tile nodes instead.
AmigaIrr
Posts: 94
Joined: Mon Jan 10, 2005 7:55 am
Location: France, Alsace

Post by AmigaIrr »

hello

have you an exemple ?

screen, code ?
L'eternité c'est long, surtout vers la fin...

Q6600 triton 79, 4 GO, 2* RAPTOR 150GO of ARECA 256 RAID 0, 3870 Zalmann, P5K. 24" Samsung. Antec nine hundred
mystic jimbo
Posts: 8
Joined: Fri Oct 13, 2006 3:12 pm

Post by mystic jimbo »

Howdy,

You use BlitzMax like I do, right? ;)

Use custom node tutorial as base.

Make an array that holds height of each tile. Make an array that holds a node for each tile.

Adjust Verctices.insert and indicies.insert lines so that each node is a rectangular tile.

Adjust values in Vertices.insert lines so that they adjust Y of each vertice according to values in the height array.

Use _SCOLOR of vertices for making dark sides of hills dark, and light sides light (use height array for figuring out when a node is on a dark or light side).

Note that each node has same X and Z values for vertices. Tiles get drawn at different parts of the scene by positioning the nodes themselves at different positions.

You will need to create a new method for the custom node in which you set the vertices, so that you can easily change the height anywhere in the code.

Here's a screenshot of very basic terrain.

Image
AmigaIrr
Posts: 94
Joined: Mon Jan 10, 2005 7:55 am
Location: France, Alsace

Post by AmigaIrr »

thanks, but this is not wath i want

i such a "proper" 2D terrain, making cas by case, in real 2D, with lights effects
L'eternité c'est long, surtout vers la fin...

Q6600 triton 79, 4 GO, 2* RAPTOR 150GO of ARECA 256 RAID 0, 3870 Zalmann, P5K. 24" Samsung. Antec nine hundred
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, took a long time to find an answer... Maybe better create a new thread and explain what you want to do.
Post Reply