Terrain Caves in Irrlicht
Posted: Sun May 27, 2007 1:10 am
Hey guys, I started experimenting with ways to make caves using just Irrlicht terrain because everyone is always moaning about "Morrowind" or whatever it was that did this. And I think the results are not too bad...
(Removed Screeny cuz it was misleading, better to download example and try number 4 method!)
You can download the program here (Thx Spintz):
http://irrnet.spintz.com/CavesTest.zip
It includes 3 different methods I experimented with to get (Nearly) the same result. They are all a bit juvenile and hacky, but I think the last method is definately the best (Only requires one heightmap file and supports correct dynamic lighting).
The three methods are:
Inverted Heightmap - An identical but inverted (in paint ) heightmap file is loaded on top of the original, with backface culling disabled so that the underside is visible. This is the first one I tried but it gives poor performance because the other side of the "ceiling" terrain has to be drawn and also the normals are the wrong way round for dynamic lighting.
Rotated Mirrored Heightmap - An identical but horizontally mirrored (in paint ) heightmap is drawn on top of the original. Backface culling is NOT disabled so this method provides the best perforamance out of all three (I got a 5-10fps gain.) BUT it looks like crap because the rotated terrain does not line up perfectly, and much to my dismay when I tried this method the normals are still screwy for the top part.
Inverted Y-Axis Terrain - Now to me, this was the first method I thought of, but the last one I tried. Mainly because I feared something will go wrong, or look buggy, or whatever can happen when the scale is inverted. Luckily, I chose to do this just for the sake of doing a third method, and it turned out to be the best! It only requires one heightmap, the textures line up perfectly, and dynamic lighting looks just like it should. The screenshot above is using this method.
Now, while making this I realized, the most obvious advantage to this is the ease of customization by an end user, and also the ease to create maps. For example, here is the terrain file I am using in this program:
Thats right! I just opened up paint and scribbled something in 5 seconds, and no matter what you say the result does not look bad for the amount of work I put in modelling this map!
So...TRY THIS: Open up the file in the media folder "cave1.bmp" in paint, and do a little scribble in paint, and walla! You have your own customized cave map This could lead to literally hundreds of maps for an fps shooter for example, or a gigantic dungeon crawl thing.
(Please try to make the shapes as squigly as possible, no uniform shapes like squares or straight lines because there is a bug with the terrain smoothing at the mo...)
Im thinking of making a shooter called "irrCaves" based on this method sometime.
Cheers.
(Removed Screeny cuz it was misleading, better to download example and try number 4 method!)
You can download the program here (Thx Spintz):
http://irrnet.spintz.com/CavesTest.zip
It includes 3 different methods I experimented with to get (Nearly) the same result. They are all a bit juvenile and hacky, but I think the last method is definately the best (Only requires one heightmap file and supports correct dynamic lighting).
The three methods are:
Inverted Heightmap - An identical but inverted (in paint ) heightmap file is loaded on top of the original, with backface culling disabled so that the underside is visible. This is the first one I tried but it gives poor performance because the other side of the "ceiling" terrain has to be drawn and also the normals are the wrong way round for dynamic lighting.
Rotated Mirrored Heightmap - An identical but horizontally mirrored (in paint ) heightmap is drawn on top of the original. Backface culling is NOT disabled so this method provides the best perforamance out of all three (I got a 5-10fps gain.) BUT it looks like crap because the rotated terrain does not line up perfectly, and much to my dismay when I tried this method the normals are still screwy for the top part.
Inverted Y-Axis Terrain - Now to me, this was the first method I thought of, but the last one I tried. Mainly because I feared something will go wrong, or look buggy, or whatever can happen when the scale is inverted. Luckily, I chose to do this just for the sake of doing a third method, and it turned out to be the best! It only requires one heightmap, the textures line up perfectly, and dynamic lighting looks just like it should. The screenshot above is using this method.
Now, while making this I realized, the most obvious advantage to this is the ease of customization by an end user, and also the ease to create maps. For example, here is the terrain file I am using in this program:
Thats right! I just opened up paint and scribbled something in 5 seconds, and no matter what you say the result does not look bad for the amount of work I put in modelling this map!
So...TRY THIS: Open up the file in the media folder "cave1.bmp" in paint, and do a little scribble in paint, and walla! You have your own customized cave map This could lead to literally hundreds of maps for an fps shooter for example, or a gigantic dungeon crawl thing.
(Please try to make the shapes as squigly as possible, no uniform shapes like squares or straight lines because there is a bug with the terrain smoothing at the mo...)
Im thinking of making a shooter called "irrCaves" based on this method sometime.
Cheers.