Dal Posted July 3, 2016 Share Posted July 3, 2016 Ok, time to share a preview of something I have been working on for a couple of months now: A quadtree LOD terrain for Babylon. So far I have: - Chunking system with infinite paging - Distance based LOD - Custom meshing - Basic UVs and texturing - Bakes to Babylon GroundMesh objects so all the usual functions, physics etc works. - Perlin based height data generation. The bad news is, its currently slower with the LOD than without it, mainly due to memory and garbage collection pressure. I need to make it more efficient at caching the unchanged data between updates and massively reduce the number of new objects created. I'm also duplicating vertices at the moment, I need to fix that. And of course... the infamous seams. At the moment there are cracks between the LOD which need to be handled with seam generation. If anyone has interest in helping, let me know.. I am going slightly crazy developing this jerome, Dad72, Boz and 1 other 4 Quote Link to comment Share on other sites More sharing options...
jerome Posted July 3, 2016 Share Posted July 3, 2016 Impressive ! Do you have any public repo somewhere so we could check the code (and maybe help) ? Dal 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted July 3, 2016 Author Share Posted July 3, 2016 4 minutes ago, jerome said: Impressive ! Do you have any public repo somewhere so we could check the code (and maybe help) ? Not yet... I am just doing some major refactoring first... I have had another idea of something to try. After that I will post it in a repo Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 3, 2016 Share Posted July 3, 2016 Can wait to integrate it Quote Link to comment Share on other sites More sharing options...
Dal Posted July 5, 2016 Author Share Posted July 5, 2016 I've made a repo of this but not sharing it publicly yet because it's still far too broken. If anyone has interest in testing/helping though just drop me a message Quote Link to comment Share on other sites More sharing options...
Dal Posted July 11, 2016 Author Share Posted July 11, 2016 I'm starting to think I will never be able to get this fast enough to be useful Quote Link to comment Share on other sites More sharing options...
Dal Posted July 11, 2016 Author Share Posted July 11, 2016 Anyone around who is good at working with low level stuff in Babylon such as buffers? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2016 Share Posted July 11, 2016 What is your question? Quote Link to comment Share on other sites More sharing options...
Dal Posted July 11, 2016 Author Share Posted July 11, 2016 1 hour ago, Deltakosh said: What is your question? More than a question really... I need someone to take a look at the code and figure out what the hell can be done to speed it up The code basically works, I think its probably just a case of optimizing the amount of data that is being passed around but I don't understand the low level stuff enough and it's not really documented AFAIK Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 11, 2016 Share Posted July 11, 2016 Unfortunately I'm pretty busy this times...But one first question: are you using an updatable vertex buffer? Quote Link to comment Share on other sites More sharing options...
Dal Posted July 11, 2016 Author Share Posted July 11, 2016 1 hour ago, Deltakosh said: Unfortunately I'm pretty busy this times...But one first question: are you using an updatable vertex buffer? I'm setting the positions like this in the constructor: this.mesh.setVerticesData(VertexBuffer.PositionKind, positions, false); I figured that is the correct thing to do because the positions are only set once. It works by calculating ALL the possible verts for the terrain, and then uses the indices to pick which ones are part of the mesh. Maybe that's not a good way to work in Babylon though, I don't know enough about the low-level stuff :S Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted July 13, 2016 Share Posted July 13, 2016 It could work so explain me how it works? Quote Link to comment Share on other sites More sharing options...
Dal Posted July 15, 2016 Author Share Posted July 15, 2016 @Deltakosh I've managed to get a bit further on it... it's getting close to being usable now, but I need to improve the distance function. After that I can try to get it to run in the playground or at least some kind of online demo. There are definitely still a lot of stupid performance-affecting issues in the code right now though, I hope the core team and the community here will be able to help squish them. Boz and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Boz Posted July 17, 2016 Share Posted July 17, 2016 Thanks Dal for this promising feature. Do not worry too much about performance, you already had a good idea which can be improved I wish I could help you but I don't have enough skill/time so far :X Good luck ! Quote Link to comment Share on other sites More sharing options...
Dal Posted July 18, 2016 Author Share Posted July 18, 2016 It's finally starting to get somewhere close to useful jerome 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted July 18, 2016 Author Share Posted July 18, 2016 That image has 3 LODs, here you can see how it looks in wireframe. Dad72 and jerome 2 Quote Link to comment Share on other sites More sharing options...
Dal Posted July 19, 2016 Author Share Posted July 19, 2016 Just playing a bit with water and texture settings to make it look pretty jerome, iiceman and Boz 3 Quote Link to comment Share on other sites More sharing options...
Dal Posted July 19, 2016 Author Share Posted July 19, 2016 Looks reasonably nice now imo. I guess I will add threading next, and then we'll see how the performance is. adam, Temechon, jerome and 4 others 7 Quote Link to comment Share on other sites More sharing options...
Temechon Posted July 19, 2016 Share Posted July 19, 2016 Wooooow it's beautiful ! What about performance ? Is a demo available ? Quote Link to comment Share on other sites More sharing options...
Dal Posted July 19, 2016 Author Share Posted July 19, 2016 58 minutes ago, Temechon said: Wooooow it's beautiful ! What about performance ? Is a demo available ? Performance is great. As long as you have an i7 CPU I have a few ideas for optimizations, then i will release something so all you smart guys can find MORE speed from it (I am pretty sure there will be some big optimizations that could be done with a few lines of code by someone who understands the low-level stuff better than I do). Quote Link to comment Share on other sites More sharing options...
jerome Posted July 19, 2016 Share Posted July 19, 2016 I have ideas abour getting a constant number fo vertices, say something like a constantly updated ribbon-like mesh What is the main principle behind your LOD method ? Quote Link to comment Share on other sites More sharing options...
Dal Posted July 20, 2016 Author Share Posted July 20, 2016 OK guys, I think its just about usable now. The biggest problem is that it slows down big time whenever it loads new chunks in... I tried to solve it with threading but so far it broke more than it solved so I'm going to park that for now. You should be able to check out https://git.loudened.com/babylon/terrain.git now with your git client.@Temechon @jerome (or anyone else for that matter) It would be really cool if you can find some way to improve the speed of it Dad72, iiceman and jerome 3 Quote Link to comment Share on other sites More sharing options...
Dal Posted July 20, 2016 Author Share Posted July 20, 2016 meteoritool, NasimiAsl, jerome and 1 other 4 Quote Link to comment Share on other sites More sharing options...
iiceman Posted July 20, 2016 Share Posted July 20, 2016 That looks super cool! I'll keep watching. Can't wait for the first playground (but I might just check the git repo out tonight to get a little sneak peek) Quote Link to comment Share on other sites More sharing options...
jerome Posted July 20, 2016 Share Posted July 20, 2016 Not sure I understand all your code. What is the main principle behind the hood ? Do you create new chunkq of terrain on the fly ? how do you dispose the useless ones ? or do you re-use them ? I would have used a different approach : - to have a huge logical terrain, whatever its source : heightmap, perlin noise computation, etc... well something too big to be rendered with vertices but easily defined by a set of vertices (x, y, z), well like ribbon paths or arrays - to have an updatable renderable mesh designed by a pool of different LOD stripes : imagine, say, three concentric squares (BJS grounds), the farthest with the lowest LOD, the closest with the highest LOD - to shift the mesh vertex values along the logical terrain array according to the camera position in the World : the farthest square would be defined for example with 1 logical coordinate set every 100 ones, the middle one with 1 on 20, the closest with all logical coordinates (not pertinent values) Just to say that each stripe picks its part of logical coordinates but not with the same density. This would be some kind of "moving mesh" in the logical array, although immobile in the World, according to the cam moves and the mesh would be updated by the current logical coordinates. So only a pre-defined updatable mesh, no allocation, no destruction, just vertex position updates (maybe uvs also) what is really fast not sure I'm very clear adam 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.