Luigi

Streaming models for large environment

Recommended Posts

Hello everybody,

we need to publish a large urban environment (150Km2) on-line and we really like the look that you can achieve in Babylon compared to alternatives like Cesium.

My question is, is it possible to have small tiles (0.25-1Km2) streamed from a server (AWS/Azure/GCloud) whenever the user gets within a certain distance?

 

Many thanks,

Luigi

Share this post


Link to post
Share on other sites

Thank you Deltakosh for your reply.

Our environment is made up of accurate 3d models of buildings and land. Will we be able to stream those too on-demand from a server?

If so, where should we start? I know it's a broad question, but I mean what do I need to publish those models and make them stream from an AWS server?

Share this post


Link to post
Share on other sites

An environment can be broken into tiles or chunks. I've only done this in two dimensions, but given that a realistic map exists almost entirely along the horizontal plane I think the same logic from a 2D game can apply.

In 2D games it is common to have tiles, and then we can convert the player's x,y coordinates (x,z if in 3d) to find the tile coordinates. The tiles are just in a 1D or 2D array. Usually its a 1D array because javascript arrays are 1D naturally and some simple math can turn x,y into an index within the array. Some more math can then load the tiles that are +/- 100 units away from the player (or whatever, depending on the view).  This approach can work for fairly large maps, but at some point the maps are so big that the idea of having the whole map in a single array in memory won't work.

When these maps get truly massive, we can no longer just have them in memory as an array... instead we need something conceptually similar to pagination, where we only work with a finite section of data that comes from something much larger or even infinite. In games this is sometimes called chunking. Minecraft popularized this term. A very large tile map (just an example) can be divided up into chunks that are 32x32 tiles. Converting the player's coordinates to chunk coordinates is just a matter of dividing their x,y by the size of a chunk (e.g. 32 tiles x 16 pixels, or 0.25 km). After we have the chunk coordinates we can load or generate the chunk the player is in, as well as any neighboring chunks up until we feel we have enough map to satisfy the view distance. In 3D this is going to be a similar process, but perhaps there are some cooler things at our disposal such as LoD.

I don't know enough about babylon to guess at chunk sizes or what the general constraints would be.

 

Share this post


Link to post
Share on other sites

thank you ALL for the pointers.

timetocode yes I am familiar with chunking, in-fact I use it in Unreal Engine. The issue now is, how to actually implement it in BabylonJs?

 

I mean where would you put the logic in?

In the player, so depending on the player's current coordinates you load/unload certain chunks/tiles?

 

Alternatively, would it be possible to have, say, a bounding box (maybe by creating a simple transparent box) for each chunk/tile. Make it larger than its contents. When the player enters that box, it triggers a little loading script for that chunk/tile?

That's one of the ways it works in Unreal Engine... would it work here as well? And if so, how do I do it?

 

Thank you,

Luigi

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.