jerome

Dynamic Terrain

Recommended Posts

better resolution but bigger terrain : 300 x 300 quads ... big LOD in the distance ([4, 3, 2, 2, 1, 1, 1, 1]) and more detailed map : 2000 x 2000 points, so 4 millions of coordinate triplets

http://www.babylonjs-playground.com/#FJNR5#130

I suppose this fulfills the requirement about the ability to depict things miles away in the distance :D

Share this post


Link to post
Share on other sites

I just updated it so there are a little less terrain computation ... but GUI computations added :D

I add the same issue than yours a couple of days ago although the scene was unchanged (FPS drop). After profiling, I discovered that my browser was suddenly unable to optimize the terrain code for no visible reason. I just upgraded my browser to the latest version (chrome 59) and it worked back at 60 fps.

FF may be a bit slower on my machine but it's always more than 45-50 fps anyway.

Share this post


Link to post
Share on other sites

Hi Jerome.

I love this extension! Thanks a lot.

I am using it for a hobby project where I need a finite square world. In the screenshot below i have populated my square world with pine trees, but the map continues infinitely in all directions:

world.png.082ef12579718b76b6d947d7606c0b3b.png

In the documentation you state that "by default, the terrain sees the map as infinite".

Is there a way to prevent this? I would like to show the map only once with no repeating at the edges. Is that possible?

Share this post


Link to post
Share on other sites

Thanks Jerome.

Using that approach I can prevent the user from looking at or exceeding the edges of the world, which might be a solution for me.

But I am trying to make some kind of 3rd person strategy game where it is possible to zoom all the way out and see the whole world surrounded by nothing but transparency.

Like this:

world_no_background.png.c3f3d348edc3ec2d883989be236adc4c.png

Or even better with a base like this:

world_w_base.png.a57824fce52af6b4670b0feb7b7b1cb6.png

I need the world to get cropped at the edges while retaining the ability to zoom and pan freely.

I can't see this is possible with your approach or am I missing something?

Share this post


Link to post
Share on other sites

Actually the dynamic terrain uses a not that big mesh in order to depict huge landscapes by moving and morphing it according to the camera movement.

In your case, you seem to need to display a static terrain, some kind of a part of a landscape if I understand well. Your terrain doesn't seem to need to move with the camera.

I think the best tool in this case is not the dynamic terrain but an updatable GroundMesh that you would morph according to your data.

Share this post


Link to post
Share on other sites

You are right - I fell a bit stupid. 

I started out using the native GroundMesh, but had much better performance using your extension.

Maybe I should play around a little more with GroundMesh and add some LOD settings.

Share this post


Link to post
Share on other sites

The DynamicTerrain extension has just been updated. For now, no new feature but a big code refactoring and optimization like the one that was made recently for the SPS.

Works with BJS 4+  (should also work with 3.3 as well)

Share this post


Link to post
Share on other sites

Here are the two new features :

- the parametric terrain position from the camera, instead of the camera hooked mandatorily to the terrain center

- the ability to restrict the perimetric LOD computation, when enabled, to some terrain sides only. Example : the camera flights and looks only straight ahead so no need to set a perimetric LOD on the terrain lower side, neither on left and right sides. The upper distant side is enough. 

https://github.com/BabylonJS/Extensions/blob/master/DynamicTerrain/documentation/dynamicTerrainDocumentation.md#camera-position

demo PG to come soon

Share this post


Link to post
Share on other sites

Just having an idea about an extra feature for the dynamic terrain : a solid particle map data. ... The possibility to set solid particles in the terrain from a map of data : here, here and here, set a house, there, there and there set a tree, etc. Describe positions of objects in the map and they will dynamically be set on the terrain when flought over by the camera

if I can achieve such a thing of course ...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.