Jump to content

Questions about large worlds with Babylon.JS


HeadClot
 Share

Recommended Posts

Hey everyone,

I am working on an unannounced multiplayer project that requires large scale level streaming. We are using height map based terrain tiles made in Unity 5 using a plugin called terrain composer.
Anyway my questions -

1. Is there any form of origin offsetting feature in babylon.js? For Example: If the player gets too far away from the origin of the scene they will start to experience floating point precision issues such as unintended screen shaking, Lighting artifacts, etc.
2. Does Babylon.js support streaming multiple large scenes? See the video below for more info about what I mean.

I have been looking through the docs and I cannot seem to find anything on these two issues.

Thank you for your time,
HeadClot

 

Link to comment
Share on other sites

4 minutes ago, fenomas said:

Many games (e.g. minecraft) deal with (1) by keeping the camera at the origin and offsetting the entire scene by the negative of the player's position.

I don't know if there's an easy convenient way to offset the entire scene in BJS. (I hope there is so I can do it too!)

I really hope that there is some sort of easy or easyish origin offset feature in BJS. I am currently digging through the Babylon JS docs atm. I might have found something in regards to tiled terrain. I think...

http://doc.babylonjs.com/classes/2.3/TiledGround

Not much on it :\

Link to comment
Share on other sites

To achieve the world streaming effect, I would advise you build a system that holds terrain in chunks - in other words, a big grid of meshes. Each chunk has it's own heightmap/height data and texture, and they can be loaded and unloaded depending on their distance. Then you can also load and unload grass/folliage/etc depending on distance as well.

YX2dCK5.png?1


At one point in time I was working on an editor that used this, and whenever I finish my project in UE4 I hope to get back at it :D

Dang, it's weird to talk about babylon after a year of being gone

EDIT: Another reason this is useful is it allows the game to request the chunks from the server only when it wants to... on other words, you do not need to download the entire world at once, just when you get close enough to a certain tile! :D

Link to comment
Share on other sites

Welcome back, Josh!  I hope you are doing well.  Hi to everyone else, too.  Yep, tiled ground and displaceMaps... good forum search terms.  I tried promoting some conversations about "smart tiles" [subMesh] that might be self-contained.  These tiles could know where they are supposed to be positioned, they might hold or can-query their heightMap data, hold/query texturing info, hold/query their current LOD level, etc.  

Few wanted to talk about it.  I don't blame them.  :)  In a way, I think we need a tileManager class.  Lots of tools to do tile/subMesh wrangling.  :)  Coraling ops.  Tile branding and herding.  Good cowboy stuff!

A "playground search" for 'tiled' does ok... http://doc.babylonjs.com/playground?q=tiled&page=2&max=25&bf=all

 

Link to comment
Share on other sites

Just now, Wingnut said:

 In a way, I think we need a tileManager class.

Sounds very interesting! I personally feel like there are two separate sections: 1) Tilemanager, which would handle stuff with meshes, folliage, and grass, and 2) and Tilemap that holds landscape tiles, which would handle heightmaps and texturing.

And I agree, tilemanager sounds awesome! :D:D
Sadly I am veryy busy with my current game, but I know I'll be coming back after that's released, and hopefully I'll find time to contribute.
 

Link to comment
Share on other sites

Hey @joshcamas - When you do resume working with Babylon.js and Large Worlds please let me know.

I have some really interesting use cases that do not really work with UE4 at the moment otherwise I would use it.
That said - I do not want to go into detail about my project in this topic. Just do not want to derail it.

Link to comment
Share on other sites

Just now, HeadClot said:

Hey @joshcamas - When you do resume working with Babylon.js and Large Worlds please let me know.

I have some really interesting use cases that do not really work with UE4 at the moment otherwise I would use it.

haha yeah, no problem! I'm really interested into this stuff as well :D

Link to comment
Share on other sites

If you wanna see a little bit of what can be done, here is a really old project of mine: samaceditor.
http://samacstudios.x10.mx/projects/Editor/

Sadly it's pretty clunky, but to use it first click "create" to create the project, then "map -> select map", "create new", then click "terrain".

Now you can sculpt and texture it with the left mouse button and change sizes and textures and stuff! To change view, middle mouse button, and to rotate camera right mouse button, and scroll to zoom.

Note that this isn't using the download capabilities, that is used when you load a project. :D
And yeah, very old and very bad. :(

 If you want to check out the code, I'd advise http://samacstudios.x10.mx/projects/samacEngine/terrain.js and http://samacstudios.x10.mx/projects/samacEngine/chunk.js
 

Link to comment
Share on other sites

3 minutes ago, joshcamas said:

If you wanna see a little bit of what can be done, here is a really old project of mine: samaceditor.

Sadly it's pretty clunky, but to use it first click "create" to create the project, then "map -> select map", "create new", then click "terrain".

Now you can sculpt and texture it with the left mouse button and change sizes and textures and stuff! To change view, middle mouse button, and to rotate camera right mouse button, and scroll to zoom.

Note that this isn't using the download capabilities, that is used when you load a project. :D
And yeah, very old and very bad. :(

I Think you forgot to link your editor. :P

Either way I found references to it on HTML5devs. :)

Link to comment
Share on other sites

30 minutes ago, joshcamas said:

Yeah I fixed it, sorry. Those links are quite old so I'd go check out the new one :D

I just checked it out briefly- I like it could use some polish in terms of the UI/UX is concerned.

The ability to import tiled height maps would be welcome :)

Link to comment
Share on other sites

I've been doing a lot of work with large terrains lately. I've had trouble with getting anything that runs fast. My voxel approaches with dual marching cubes and dual contouring don't run too well on mobile devices.

@joshcamas has the best approach I've seen so far (are those editor tools open source?)

I think we need to implement a proper LOD terrain using quadtree/geomipmapping to get really good big terrains in Babylon. Does anyone have any interest in working with me on it?

Link to comment
Share on other sites

52 minutes ago, HeadClot said:

I just checked it out briefly- I like it could use some polish in terms of the UI/UX is concerned.

The ability to import tiled height maps would be welcome :)

Yahh whenever I start working on SE2 I plan on completely reworking the ui. The reason I didnt implement heightmaps cause back then I thought they where dumb, but now that I've worked with UE4 I've realized my major mistake. I also plan on adding weight painted textures instead of just painting them directly on the terrain

@Dal I would not advise you to use my ui code since it's pretty old and a roundabout way of creating a gui. When I start working on SE2 I plan on making the gui separately so people can use it. SamacInterface? Lel

Also I'm afraid I don't have much time atm, but after HERO is finished I might be able to help, although I am absolutely in no way knowledgeable about webgl and such

Link to comment
Share on other sites

21 minutes ago, Dal said:

I've been doing a lot of work with large terrains lately. I've had trouble with getting anything that runs fast. My voxel approaches with dual marching cubes and dual contouring don't run too well on mobile devices.

@joshcamas has the best approach I've seen so far (are those editor tools open source?)

I think we need to implement a proper LOD terrain using quadtree/geomipmapping to get really good big terrains in Babylon. Does anyone have any interest in working with me on it?

I'm doing a lot of work with large voxel terrains as well, but not targeting mobiles so I haven't checked performance there. On a PC I can get a pretty good-sized world to run at 60fps. I chunk the world in to e.g. 32x32x32 voxels per chunk, and use Octree selection with each chunk being an OctreeBlock. I haven't tried any LOD optimizations yet, I'm not sure if they'll be worth it - it seems like the strain of large draw distances comes more from the sheer number of meshes at long distances, not from the number of vertices in each mesh - but I haven't looked at it closely.

Link to comment
Share on other sites

On 4/25/2016 at 3:24 AM, fenomas said:

I'm doing a lot of work with large voxel terrains as well, but not targeting mobiles so I haven't checked performance there. On a PC I can get a pretty good-sized world to run at 60fps. I chunk the world in to e.g. 32x32x32 voxels per chunk, and use Octree selection with each chunk being an OctreeBlock. I haven't tried any LOD optimizations yet, I'm not sure if they'll be worth it - it seems like the strain of large draw distances comes more from the sheer number of meshes at long distances, not from the number of vertices in each mesh - but I haven't looked at it closely.

Interesting. Are you planning to share/open source what you've done? Could be interesting to see if your approach is better.

Link to comment
Share on other sites

@fenomas Wow, that's really impressive! Performance doesn't seem too bad on mobile. My voxel terrains are a bit different though... I'm trying to make a more natural looking terrain using isosurfaces and I think the view distance I am trying to achieve is probably a lot further as a result.

Link to comment
Share on other sites

Thanks! But my engine isn't rendering voxels, per se - there's a meshing step where each chunk is processed into a handful of regular meshes, so it's basically a similar process to using marching cubes etc. I'd suppose the number of vertices per chunk is probably not wildly different either (unless LoD is going on).

Link to comment
Share on other sites

On 2016-04-24 at 0:20 AM, joshcamas said:

To achieve the world streaming effect, I would advise you build a system that holds terrain in chunks - in other words, a big grid of meshes. Each chunk has it's own heightmap/height data and texture, and they can be loaded and unloaded depending on their distance. Then you can also load and unload grass/folliage/etc depending on distance as well.

YX2dCK5.png?1


At one point in time I was working on an editor that used this, and whenever I finish my project in UE4 I hope to get back at it :D

Dang, it's weird to talk about babylon after a year of being gone

EDIT: Another reason this is useful is it allows the game to request the chunks from the server only when it wants to... on other words, you do not need to download the entire world at once, just when you get close enough to a certain tile! :D

Problem about this method is that there will always be visible "seams" between tiles.

Link to comment
Share on other sites

9 hours ago, Gugis said:

Problem about this method is that there will always be visible "seams" between tiles.

You don't get visible seams unless the LOD of the tiles is different... but it does kinda need to be if you want a very large world for performance reasons.

Link to comment
Share on other sites

15 hours ago, fenomas said:

Thanks! But my engine isn't rendering voxels, per se - there's a meshing step where each chunk is processed into a handful of regular meshes, so it's basically a similar process to using marching cubes etc. I'd suppose the number of vertices per chunk is probably not wildly different either (unless LoD is going on).

On small terrains its OK, but with a good view distance I really get problems.

To rule out the voxels as the issue I've had a go using tiled ground meshes based on @joshcamas method and I'm still seeing about 82% of the time spent in the renderloop and only about 10fps on mobile, so I figure it must be just the sheer number of verts causing the problem.

Link to comment
Share on other sites

@Dal Is the time being spent in mesh selection, or elsewhere?

In my scenes so far selection is usually the issue, but that's partly because I add chunks in a sphere around the player, so the number of meshes grows as distance cubed. If you're only doing a ground mesh then of course it'll grow as distance squared, and scale differently.

As for vertices, in my scenes like the demo I linked, a typical chunk has 1000-2000 vertices.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...