Terrain?
BlitzMax Forums/MiniB3D Module/Terrain?
| ||
Hi, just a small question. Will the Terrain/Heightmap-stuff be implemented in MiniB3D? Or is the only way a Meshterrain? |
| ||
I'll probably add a simplistic terrain system (no LOD), but anything more complex is unlikely to be added for a while. |
| ||
There was a MiniB3d thread some months ago related to mesh terrains: here fredborg posted a useful LoadTerrain function in that thread. I’ve been meaning to modify his code to incorporate some sort of LOD system (‘chunking’, perhaps), but I just don’t know if that will be enough… If I can get motivated I'll do some experiments and post my results here. |
| ||
Okay, before I try anything, can somebody please explain to me why the following Blitz3D code is ten times faster than the equivalent BlitzMax + MiniB3d code when rendering a mesh? (You’ll need to provide a heightmap and a texture). Blitz3D: BlitzMax + MiniB3D: 128x128 heightmap gives me: * Blitz3D: 700 fps approx * BlitzMax + MiniB3D: 75 fps approx System Specs: 1.6Ghz Centrino, 512MB ram, 128MB ATI Mobility Radeon X700 Debug and Release display the same speed difference. Is it a DirectX vs OpenGL issue? MiniB3D’s architecture cannot handle large meshes as efficiently as Blitz3D? Am I doing something stupid? |
| ||
Probably a vertex buffer thing. MiniB3D doesn't yet use these, B3D does, and Kelpto's version does. |
| ||
yeah: 128 * 128 = 16 384 that is alot of vertices/polys to render from main mem i guess. when klepto releases a new version (after easter break) we'll try a VBO version. as for Terrain LOD algorithms, I think Blitz3D's is based on ROAM ? (i remember that from 4-5 years ago so my memory might be wrong) http://www.cognigraph.com/ROAM_homepage/ |
| ||
Ah well, I suppose I need to wait then. I did try an earlier version of klepto2's extended version but it kept crashing when loading larger heightmaps (>=256x256), so I suppose some sort of 'chunking' system will be required in any case... Thanks for the link bradford6. |
| ||
Actually, I might be able to code a terrain chunking system in MiniB3d as it is now. It handles meshes generated from 64x64 heightmaps without problems. (Not as fast as Blitz3d, but close : both are > 800 fps)... We'll see... |
| ||
Here are the results of my 'chunking' experiment: |
| ||
Nice piece of code impixi :) I have modified it a bit to get it work with VBOs and thats my results: Without VBOs: ~350 FPS With VBO: ~950FPS If you agree I will add this to my next release, as it is really clean written and it seems very extendable. |
| ||
Without VBOs: ~350 FPS With VBO: ~950FPS Heh, those VBOs seem like useful things! :) If you agree I will add this to my next release, Sure, go for it. Probably the most significant missing items are: * TerrainY() method - for use in entity placement. * PreLoadTexture method – for use in real-time texture changes. * Collision-related methods. |
| ||
I have also tried to implement some frustum culling, which pushes the fps again up to 1000 fps with VBOs and a tarrain map of 512*512. If you have my module, you could test the VBOs yourself: Change your createChunk method abit: UpdateNormals mesh mesh.UpdateBuffer() Return Mesh And it should compile. |
| ||
[necro] @impixi>>your LoadMeshTerrain() procedure/function produces a terrain which is inverted on the z axis... [/necro] |