jerome Posted March 6, 2017 Author Share Posted March 6, 2017 wait, wait, lots of things to code still ... NasimiAsl and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 8, 2017 Author Share Posted March 8, 2017 current WIP : http://www.babylonjs-playground.com/#K7IWX still a bug that drives me crazy in the camera elevation auto-LOD ... :-( [EDIT] I've got an idea to solve this, I will check tomorrow Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 9, 2017 Share Posted March 9, 2017 This is impressively fast Quote Link to comment Share on other sites More sharing options...
jerome Posted March 9, 2017 Author Share Posted March 9, 2017 This is the goal : to try to reach something close to the speed of the GPU-side Nasimi's project and to have almost the same features than the (too slow for him) CPU-side Dal's one like the LOD in the distance. If I can achieve this one (I'm pretty confident now, I'm close to the end of the pure geometry issues), it should have the following feautres : - dynamically built on any dataset : at least a height map, but this could be a set of 3D coordinates (imposed format and constrained though, this will be documented), with added color and uvs data - possible LOD : you can dynamically add or remove LOD thresolds and values to reduce the terrain number of vertices used to depict things in the distance or to expand the terrain size in the same time - autoLOD with camera elevation : when the camera elevates the terrain auto adapts to both extends and reduce the current LOD - the terrain automatically moves with the camera : all the magics (marketing word for f...ck complex computations of terrain index/position according to both the current camera and map data positions) lives here : a single mesh is dynamically morphed from the logical map system and positioned in the World space, so no vertex creation/deletion, no memory allocation/release, etc. All is focused only on the maths to update as fast as possible and only when required this single mesh. - camera horizontal movement tolerance possible : the user can choose to trigger the terrain recomputation only beyond some camera distance of moving from the current location. Example : the camera can fly over 10 terrain cells in any direction before the terrain starts to udpate - the terrain is by default infinite : if the camera reaches the map edge, the terrain goes on sliding from the opposite map edge as the map were infinetly tiled. - possible custom behavior : a user function is called on terrain update on each terrain vertex so the user can add its own logic. Imagine a simple flat terrain on a simple flat map, the user can add moving waves in function of the time and other own parameters (wind, etc) and he immediatly gets a living ocean :-) I wish I can show a decent final working geometry by the end of this week... Dad72 and adam 2 Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 9, 2017 Share Posted March 9, 2017 Watching the development of the terrain with impressed interest. Quote Link to comment Share on other sites More sharing options...
jerome Posted March 9, 2017 Author Share Posted March 9, 2017 Well, I thought that I couldn't achieve it after some sharp headache at dealing with all the indexes... but finally : http://www.babylonjs-playground.com/#1MR44S#1 What do you get here ? a 100 x 100 terrain (not that big mesh) it's given an initial LOD setting like this : this._LODLimits = [3, 2, 2]; // array of LOD limits what means that the LOD factor is 1 (default) everywhere, except for the 3 first cells (on x and z) where it's default+1 well, as they then are other values in the array, just re-apply the same rule : we've told it was default+1 for 3 first, but it's default+2 for the first two oops, another last "2" in the array ? ok, let's increment again so default+3 for the first two Actually, the rule is : the LOD factor is incremented for 1 for each cell thresold, expressed from the terrain edge in the descending order. This little picture should help to understand LOD = [6, 4]. This means there 6 cells before default lod factor at default+1... and on these 6, there are 4 cells more at default+2 Imagine that the camera is always on the center of the terrain. Actually, the terrain is hook to the camera on its center and it's morphed according to the data of the map flought over by the terrain. So the relief in the distance (from the center) is drawn with less, but bigger, cells than the things close to the camera. Ok ? Note that you can change on demand those settings at any time ! The Dynamic Terrain provides an extra feature : it automatically computes new LOD values when the camera elevates. Use the keyboard cursor arrows and you'll notice that the terrain expands, the cells become bigger and the details less visible. You can set your own behavior with this custom function : /** * Custom function called each frame and passed the terrain camera reference. * This should return a positive integer or zero. */ DynamicTerrain.prototype.updateCameraLOD = function(terrainCamera) { // LOD value increases with camera altitude var camLOD = (terrainCamera.position.y / 10.0)|0; return camLOD; }; Not complete ... the uvs and colors now :-p [EDIT] Pilot with your mouse (keep clicked) and beware when it's getting red ;-) http://www.babylonjs-playground.com/#1MR44S#2 adam and Dad72 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 9, 2017 Share Posted March 9, 2017 With UI: http://www.babylonjs-playground.com/#1MR44S#5 jerome and Dad72 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 9, 2017 Author Share Posted March 9, 2017 The same with a little (final ?) fix to support high camera speeds : http://www.babylonjs-playground.com/#1MR44S#7 plain : http://www.babylonjs-playground.com/#1MR44S#8 I suppose we can consider that the terrain renewal speed challenge is met ;-) Get elevation with the keyboard cursos key (even when stopped with the UI) to see the LOD in action. gryff and JohnK 2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 10, 2017 Share Posted March 10, 2017 Ok this is utterly cool Quote Link to comment Share on other sites More sharing options...
jerome Posted March 10, 2017 Author Share Posted March 10, 2017 want to pilot a helicopter ? http://www.babylonjs-playground.com/#2FD2SC JohnK 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted March 11, 2017 Share Posted March 11, 2017 Woo! This looks really nice. The speed seems really good although I'd like to see how this looks with a high detail terrain with texturing and far view distance - thats where my implementation started to show it was slow. Quote Link to comment Share on other sites More sharing options...
jerome Posted March 12, 2017 Author Share Posted March 12, 2017 pressuring challenge :-P Quote Link to comment Share on other sites More sharing options...
jerome Posted March 13, 2017 Author Share Posted March 13, 2017 Do you prefer to pilot a (naive) jet ? http://www.babylonjs-playground.com/#DEFXO Boz and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 14, 2017 Author Share Posted March 14, 2017 current progress : http://www.babylonjs-playground.com/#29JWLZ#3 GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 15, 2017 Author Share Posted March 15, 2017 Last refactor and fix : http://www.babylonjs-playground.com/#29JWLZ#4 no more texture visible seams \o/ Quote Link to comment Share on other sites More sharing options...
jerome Posted March 15, 2017 Author Share Posted March 15, 2017 The feature "color map" is now also working : http://www.babylonjs-playground.com/#29JWLZ#5 funnier : http://www.babylonjs-playground.com/#29JWLZ#6 obviously, this works with textures too : http://www.babylonjs-playground.com/#29JWLZ#8 JohnK 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 15, 2017 Author Share Posted March 15, 2017 a bit more punchy at low altitude http://www.babylonjs-playground.com/frame.html#29JWLZ#10 more again : http://www.babylonjs-playground.com/frame.html#29JWLZ#11 Dal 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted March 15, 2017 Share Posted March 15, 2017 Needs a really really like it button? jerome 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted March 16, 2017 Share Posted March 16, 2017 Now you're really getting somewhere! Looks promising. jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 16, 2017 Author Share Posted March 16, 2017 http://www.babylonjs-playground.com/frame.html#29JWLZ#12 Just a different precomputed random world, with more heterogeneous mountain styles... can't stop to explore (press F11 for full screen), flying at low altitude NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 17, 2017 Author Share Posted March 17, 2017 wave experimentation http://www.babylonjs-playground.com/#29JWLZ#14 Quote Link to comment Share on other sites More sharing options...
Javierl Posted March 17, 2017 Share Posted March 17, 2017 Wow, this looks really good! Awesome work! jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 18, 2017 Author Share Posted March 18, 2017 weird http://www.babylonjs-playground.com/#29JWLZ#15 Quote Link to comment Share on other sites More sharing options...
jerome Posted March 21, 2017 Author Share Posted March 21, 2017 First working port to TS and first working compiled minified version here : https://github.com/BabylonJS/Extensions/tree/master/DynamicTerrain/dist doc to come NasimiAsl and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
Javierl Posted March 22, 2017 Share Posted March 22, 2017 Looking forward to read the docs :). I'm assuming this should work for what I'm trying to do: Have a multiplayer game in which the server defines the map (somehow, maybe multiple heightmap images?) and then when players connect, they "download/stream" chunks of the map as they move? This way I would be able to build a massive world in which players can move around. I still have to see how I can handle the collisions and so on but we'll cross that bridge when we come to it... This whole thing looks really good, I just hope I'm not too dumb and I can understand enough bits of it so I can make use of it... 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.