Page 1 of 1

Making 3D tile-based terrain?

Posted: Fri Oct 13, 2006 3:34 pm
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.

Posted: Fri Oct 13, 2006 5:55 pm
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.

Posted: Sat Oct 14, 2006 12:51 pm
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?

Posted: Sun Oct 15, 2006 7:55 am
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

Posted: Mon Oct 16, 2006 10:07 am
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.

Posted: Mon Oct 16, 2006 3:06 pm
by AmigaIrr
hello

have you an exemple ?

screen, code ?

Posted: Tue Oct 17, 2006 10:29 am
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

Posted: Sat Mar 14, 2009 7:19 pm
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

Posted: Sat Mar 14, 2009 8:47 pm
by hybrid
Hmm, took a long time to find an answer... Maybe better create a new thread and explain what you want to do.