Free mesh terrain library...

Community Forums/Showcase/Free mesh terrain library...

Beeps(Posted 2003) [#1]
Yup, here it is. A free tiled mesh terrain lib, it could use some work but I'm too busy and too bored with it to finish it off properly. If anyone does anything real cool with it would you please post the updated source for other users.



2.5mb - http://www.binary-people.com/downloads/freemeshterrainlib.zip

handles tiles around the camera and textures each one, runs from a huge heightmap right now but you could change it to run from any kind of data.

possible enhancements include -

o heights not limited to 0-255 range.
o dynamic fractal terrain creation and texturing, think 'rescue on fractalus - lucasarts'
o load of other stuff

If ya use it, credit me if you can, ;)

oh, once the terrain is set up you just call this...

MeshTerrain_Update(camera)

once per loop and it updates the terrain to show based on your 'camera' object position. there's a demo included so you can see how it's done and also some rather dodgey grass code. Don't moan at me about it and don't ask how it all works, I'm not interested (laughs out loud) it's only 6 or 7 functions and is very straight forward from the demo.

enjoy!


jfk EO-11110(Posted 2003) [#2]
Looks good! How dod you solve the Tile-Border Problem?


Beeps(Posted 2003) [#3]
just made sure I got the coords right, there's also a custom height function. ;)


Beeps(Posted 2003) [#4]
hmmm the grass code is far worse than I remember. here's a demo without the grass...


http://www.binary-people.com/downloads/meshterraindemo.bb

and another shot showing a tile border ;)




Beeps(Posted 2003) [#5]
woah thought I'd lost my post for a second, after rooting through my IRC logs I've found it though. Anyone going to use this?


Ricky Smith(Posted 2003) [#6]
the link doesn't work for me !


John-Robin(Posted 2003) [#7]
sorry but the zip file seems to be missing a texture.

John-Robin


Beeps(Posted 2003) [#8]
OK, I missed the grass texture, Sorry :(

It's uploaded now. www.binary-people.com/downloads/grass.png <-- stick that in your dir if you've already got the zip, OR the zip now includes this rather lame grass texture if you want to download the whole thing.


Beeps(Posted 2003) [#9]
another shot showing the grass...




jfk EO-11110(Posted 2003) [#10]
True Tiles on Terrains is something I will shurely use, thanks a lot!


Beeps(Posted 2003) [#11]
Just to clear this up, it's not Blitz Terrains, it's all custom meshes aligned properly with their own textures. A complete alternative to Blitz Terrains.

Thanks Beaker for pointing out the potential for confusion.


Wiebo(Posted 2003) [#12]
great stuff!!!


jfk EO-11110(Posted 2003) [#13]
Yeah, of course. So the Meshes are Childs? Might be slower than a Single Surface solution, but also allowes to skip things out of Camerarange or behind the Camera. And of course, the Tile Border Problem of single Surface Meshbased Terrains is solved.


Beeps(Posted 2003) [#14]
slower? that 103 fps in the last pic was with my crappy single surface grass windowed in 32bit on a 1.5gig pc with 30,000 polys. hmmm, improve on it if you like ;)


jfk EO-11110(Posted 2003) [#15]
It's just the way that single Surface Things work faster than multiple Surface things. But this doesn't mean that single Surface Solutions can be used for everything.


sswift(Posted 2003) [#16]
"Just to clear this up, it's not Blitz Terrains, it's all custom meshes aligned properly with their own textures."

That's how my terrain system works, though I had multiple levels of detail for each tile. But there's a lot of problems working with those, I don't reccomend it. Even if you solve the cracks between tiles issues, it's still a pain to deal with collision issues.


"It's just the way that single Surface Things work faster than multiple Surface things. But this doesn't mean that single Surface Solutions can be used for everything."

A single surface terrain will only be faster than a segmented terrain of equal size if the majority of the terrain is visible at all times.

Now what you could do is a hybrid technique which does DB-like terrains, but puts a lot of them on a terrain. That would allow you to have large sections of terrain with detailed texturing. However, it would be kludgy to deal with each section of terrain having an individual tile set, so either you deal with the kludge or you require every tile of the terrain to use the same tileset. It's also problematic having different ground surfaces that smoothly transition from one another.

One alternative without the DB-like tiles, is to use a unique texture for each tile, but that then limits you to a small number of textures, which are relatively low res since the tiles need to be large, unless you have a short view distance.

The other alternative comes at a speed cost. You can render the terrain with multiple passes and use vertex alpha to blend between different textures. This allows you to scale the textures down which gives them a high detail appearance, yet you can still have smooth transitions between textures.

The last alternative I haven't quite worked out yet. It may be possible to use the above method but instead of vertex alpha, use an alpha map. This would allow much more detailed and better looking texture transitions. However because we want to be able to scale the textures down, this alpha map can't be part of the individual textures. So some way would need to be found to get the alpha information from one texture layer to the one below it, so that the alpha map can be scaled up and the texture itself scaled down, independently. I don'tknow if setting the second texture layer's blend mode to alpha will do that. I'm pretty sure it won't. But I could be wrong. Then again perhaps if one disables all the texture flags when loading the texture and disables the color flag but enables the alpha flag then it will blend only the alpha. Testing would need to be done on a number of cards if this method did work to make sure it works on all cards without bugs.


Beeps(Posted 2003) [#17]
woah, that's great sswift - you really sound like you know what you're talking about. Well done.

As for this code, if anyone wants it it's up there, if you don't then no biggy.

Cya around all.


Neo Genesis10(Posted 2003) [#18]
Great stuff. I had designed a mesh terrain loader (using multiple meshes for large bitmaps) which I may just put in the archives. Its pretty seamless, but to have proper tiled terrains stretching for infinite - tis my goal.