jerome Posted April 4, 2017 Share Posted April 4, 2017 Hi folks, Maybe some of you followed this topic for while : Well, now I'm proud to announce the fully documented first release of the Dynamic Terrain Extension : https://github.com/BabylonJS/Extensions/tree/master/DynamicTerrain Its documentation is one the same repo : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md Have fun Some more demos and features to come V!nc3r, aWeirdo, Boz and 7 others 10 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 4, 2017 Share Posted April 4, 2017 I'll probably try it one day. it sounds cool, but it also seems complex at first. But I intend when I would look over, to add this to my terrain editor. Great work on this land dynamic. I have a question, the vertexes can be dynamically raise ? (as on my terrain editor) We can add a dynamic texture for the paint? Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted April 4, 2017 Author Share Posted April 4, 2017 yes to all :-) and it's quite simple actually ... just pass it a data map to build a terrain for a FPS game for instance. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted April 4, 2017 Share Posted April 4, 2017 I believe that I have understood. I made a simple demo here with flat terrain. http://www.babylonjs-playground.com/#FJNR5#36 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 4, 2017 Share Posted April 4, 2017 Congrats Jerome! Once again a great feature for the community! Wingnut 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted April 4, 2017 Author Share Posted April 4, 2017 @Dad72 : you've understood everything ;-) I just change the y to some cosinus * sinus instead in your demo : http://www.babylonjs-playground.com/#FJNR5#37 @Deltakosh : thanks a lot Quote Link to comment Share on other sites More sharing options...
jerome Posted April 5, 2017 Author Share Posted April 5, 2017 I just started a documentation about use case examples : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainExamples.md JohnK, Wingnut, Dad72 and 1 other 4 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 5, 2017 Share Posted April 5, 2017 You should add it to the doc directly Quote Link to comment Share on other sites More sharing options...
jerome Posted April 5, 2017 Author Share Posted April 5, 2017 Well, the doc appears to be long enough to some of us for now https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 5, 2017 Share Posted April 5, 2017 I meant: You should move it to the documentation site Quote Link to comment Share on other sites More sharing options...
Convergence Posted June 1, 2017 Share Posted June 1, 2017 @jerome Would it be possible to add .getHeightAtCoordinates() and .getNormalAtCoordinates() to DynamicTerrain? Quote Link to comment Share on other sites More sharing options...
jerome Posted June 1, 2017 Author Share Posted June 1, 2017 Actually, this already exists : https://github.com/jbousquie/Extensions/blob/master/DynamicTerrain/src/babylon.dynamicTerrain.ts#L480 https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#useful-functions it's called getHeightFromMap(x, y, normalRef) I will add some other examples NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Convergence Posted June 1, 2017 Share Posted June 1, 2017 1 hour ago, jerome said: Actually, this already exists : https://github.com/jbousquie/Extensions/blob/master/DynamicTerrain/src/babylon.dynamicTerrain.ts#L480 https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#useful-functions it's called getHeightFromMap(x, y, normalRef) I will add some other examples Oh, great, my bad for not looking more thoroughly Sorry, another question (last I hope), does DynamicTerrain support something like .dataFromHeightMap (possibly with an offset option so a different portion of the image could be used when the player walks around)? Quote Link to comment Share on other sites More sharing options...
jerome Posted June 1, 2017 Author Share Posted June 1, 2017 About your second question, I will implement very soon a tool to generate a map (so a data set directly usable by the DynamicTerrain) from a height map image. NasimiAsl and Convergence 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 2, 2017 Author Share Posted June 2, 2017 New internal improvement : Now when you set a data map to the terrain, all the map normals are pre-computed once and stored internally. This is a heavy operation, but done only once. Then the terrain mesh uses now by default all these pre-computed normals instead of recomputing its own ones each time it's updated. If the terrain is very large, its normal re-computation can be an intensive process what impacts the FPS. So, unless you request it explicitly with terrain.computeNormals = true; // now false by default the mesh normal computation is now skipped. Documentation updated : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#normal-map In brief, you don't need to care any longer about the normal optimizations with large terrains. adam and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 6, 2017 Author Share Posted June 6, 2017 No change in the API but some internal changes to ease and speed up the Dynamic Terrain Added the ability to pre-compute statically many normal maps before assigning some new data maps to the terrain : var map1 = someFloat32Array; var map2 = someOtherFloat32Array; var map3 = someOtherFloat32Array; var normal1 = new Float32Array(map1.length); var normal2 = new Float32Array(map2.length); var normal3 = new Float32Array(map3.length); // let's precompute the normals of all the maps DynamicTerrain.ComputeNormalsFromMapToRef(map1, subX1, subY1, normal1); DynamicTerrain.ComputeNormalsFromMapToRef(map2, subX2, subY2, normal2); DynamicTerrain.ComputeNormalsFromMapToRef(map3, subX3, subY3, normal3); So now the change of data map on the fly can be associated with the change of normal map (so no interleave normal computation) var map2 = someOtherFloat32Array; var normal2 = new Float32Array(map2.length); DynamicTerrain.ComputeNormalsFromMapToRef(map2, subX2, subY2, normal2); // then, later in the code ... if (cond) { terrain.mapData = map2; terrain.mapNormals = normals2; } The map normals are precomputed automatically only at terrain construction time. If we want this automatic computation goes on for any new map assignment to the terrain, we can force it with terrain.precomputeNormalsFromMap = true; Added also the property .isAlwaysVisible to force the mesh direct selection in the culling process when we know the terrain is always in the camera fov. Documentation updated as well : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md Quote Link to comment Share on other sites More sharing options...
jerome Posted June 6, 2017 Author Share Posted June 6, 2017 CreateMapFromHeightMap() coming soon GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted June 7, 2017 Share Posted June 7, 2017 You're unstoppable Quote Link to comment Share on other sites More sharing options...
jerome Posted June 7, 2017 Author Share Posted June 7, 2017 This one will be THE wanted feature Quote Link to comment Share on other sites More sharing options...
jerome Posted June 7, 2017 Author Share Posted June 7, 2017 Tadammm : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#map-creation-from-a-height-map Example : http://www.babylonjs-playground.com/#FJNR5#125 + some easing method about UV Map called, weirdly, createUVMap() : https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#uv-map @Convergence at last, CreateMapFromHeightMap() Convergence 1 Quote Link to comment Share on other sites More sharing options...
Dal Posted June 7, 2017 Share Posted June 7, 2017 @jerome looking *really* good! Any chance of an example of a game-style terrain? Something with a first person character running around on grassy hills with a far view distance + fog so we can see how it performs in a more real-world use case. Quote Link to comment Share on other sites More sharing options...
jerome Posted June 8, 2017 Author Share Posted June 8, 2017 Just added offsetX and offsetZ to eventually shift the generated data map in the World for some amount Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted June 8, 2017 Share Posted June 8, 2017 nice job jerome jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 8, 2017 Author Share Posted June 8, 2017 First clean and commented example : http://www.babylonjs-playground.com/#FJNR5#129 You should start flying initially from the Sahara towards the Europe if I'm not wrong. I generated a big map, sized 10000 x 10000 units in the World. This map holds 1 million of points (1000 x 1000). It's generated from a symetric image so we can fly endlessly around the world in all the directions : The terrain is 150 x 150 quads. I just added a little LOD in the distance. Then everything is quite optimized : the terrain is set as always visible (no culling), the map normals are precomputed, as well for the map UV. So, ladies and gentlemen, welcome on board. The crew wishes to you an excellent flight in our skies. The meteological conditions may be good during your trip. We expect to NEVER land, nor crash and fly forever at the cruise speed of 60 FPS Same link without editor : http://www.babylonjs-playground.com/frame.html#FJNR5#129 Wingnut, adam, JackFalcon and 1 other 4 Quote Link to comment Share on other sites More sharing options...
jerome Posted June 8, 2017 Author Share Posted June 8, 2017 constant 60 FPS in chrome in full screen here 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.