Dal Posted November 25, 2015 Share Posted November 25, 2015 Hi all, I've managed to implement a geo-clipmapping terrain for Babylon It is based on the awesome writings of Florian Bösch (https://github.com/pyalot/webgl-lacr), and Jasmine Kent (who uses Florian's method and explains it nicely here: http://www.gamasutra.com/blogs/JasmineKent/20130904/199521/WebGL_Terrain_Rendering_in_Trigger_Rally__Part_1.php In theory this kind of terrain is really good for WebGL, because it puts most of the work onto the GPU and it allows very large terrains. My implementation isn't quite right at the moment though and I hit a few snags trying to implement it in Babylon: 1) Florian's implementation uses non-indexed meshes and triangles. I figured out how to create the same shapes needed using Babylon mesh functions, but I am sending waaaaay more data to the GPU than Florian does. 2) I also struggled with other issues like how to give the different meshes their own materials/settings without creating a lot of duplication.3) I'm not sure I am using all the settings correctly... I'm finding it hard to get good looking results.4) The mip levels really don't seem to be working properly5) The detailing is definitely not right either I think I've come about as far with it as I can with my understanding of Babylon... but I am hoping some smart people in this community can help me fix it / finish it Source code is at: https://github.com/darrylryan/BabylonTerrainLive demo is here Boz, WolfKodi, BitOfGold and 6 others 9 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 25, 2015 Share Posted November 25, 2015 Woot !! this is utterly cool! Dal 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted November 25, 2015 Share Posted November 25, 2015 Wow, excellent, it's a feature you want embed in babylon. That would be really great.It is impressive as the terrain is great. Dal 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted November 25, 2015 Author Share Posted November 25, 2015 Wow, excellent, it's a feature you want embed in babylon. That would be really great.It is impressive as the terrain is great. Yep, it's already open source and can be used. It needs some fixing up though. I hope you guys can help Quote Link to comment Share on other sites More sharing options...
Convergence Posted November 26, 2015 Share Posted November 26, 2015 Great contribution Does it support collisions? Quote Link to comment Share on other sites More sharing options...
Dal Posted November 26, 2015 Author Share Posted November 26, 2015 Great contribution Does it support collisions? Not tested. In theory it extends from Babylon mesh classes so it might inherit their powers Quote Link to comment Share on other sites More sharing options...
Convergence Posted November 26, 2015 Share Posted November 26, 2015 Setting checkCollisions to true on the camera, scene and the center mesh didn't seem to do much.. What shader are you using? Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted November 26, 2015 Share Posted November 26, 2015 It would be intersting to drasticaly increase camera.maxZ value to better see the infinite landscape. Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted November 26, 2015 Share Posted November 26, 2015 Ah ah, just travel at max speed through landscape as close to the ground as possible and you'll feel like a pod racer ! We juste need to raise a little more up the high mountains (and maybe add collisions) to enhance the sensation. Quote Link to comment Share on other sites More sharing options...
Dal Posted November 26, 2015 Author Share Posted November 26, 2015 Setting checkCollisions to true on the camera, scene and the center mesh didn't seem to do much.. What shader are you using? Its a custom shader... the magic to how the whole thing works is in the shader. Take a look in the source code Quote Link to comment Share on other sites More sharing options...
Dal Posted November 26, 2015 Author Share Posted November 26, 2015 It would be intersting to drasticaly increase camera.maxZ value to better see the infinite landscape. Increasing the camera size won't help because the terrain size is fixed... it doesn't actually draw infinite land, it works by drawing a single square of land and then a number of concentric rings around that, with lower LOD levels.It only actually makes one "square" of terrain in effect... the height and texture data is then pulled over it. The mesh doesn't actually get translated. The GPU moves the vertices around based on the image data, so it's lighter on the CPU.Think of it as though you're standing still and the mountains are moving It looks like this: In the parameters you can increase the number of levels of rings drawn, the grid resolution and the grid scale. The way to get a really mega view distance is to increase the number of levels.I haven't figured out how to get the scaling quite right yet though - feel free to have a play! Keep in mind I may have made some mistakes in the implementation though, so perhaps tweaks are needed in the shader to get awesome results Quote Link to comment Share on other sites More sharing options...
Dal Posted November 26, 2015 Author Share Posted November 26, 2015 Here's how it looks with a huge view distance... gridLevel of 16. Really to get it to look really great though I need you guys to help me by studying/tweaking the code a bit.. I don't think just changing the numbers is going to give us a great result, we need to tweak the implementation and shader to work better with babylon. Those of you that know what you're doing, perhaps take a look at the original and see what I did right/wrong or misunderstood? I made a start, but we need more work on it to make it really useful. Quote Link to comment Share on other sites More sharing options...
Dal Posted November 26, 2015 Author Share Posted November 26, 2015 Ah ah, just travel at max speed through landscape as close to the ground as possible and you'll feel like a pod racer ! We juste need to raise a little more up the high mountains (and maybe add collisions) to enhance the sensation. Actually I did have the exact same feeling... we could make a really good pod-racer game with this hehe In fact, increasing the mountain height is a good community challenge. I bet if you figure out how to increase the height, you will also run across where I made mistakes in the implementation and maybe you can fix them? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 27, 2015 Share Posted November 27, 2015 Do you want to create an official extension for Babylon.js with this great work? Quote Link to comment Share on other sites More sharing options...
Dal Posted November 27, 2015 Author Share Posted November 27, 2015 Do you want to create an official extension for Babylon.js with this great work? Sure, that would be cool. I think it does need some more attention from core devs to be useful though... its bugged right now and I am not sure if I can fix it alone Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 28, 2015 Share Posted November 28, 2015 Let me know when you will consider it robust enough 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.