Strategies for large terrains

I’m going to implement a reasonably large terrain and would like some ideas and feedback before I get into it. The terrain should be about 500m x 300m at most. It is an island and its underwater environment. The terrain will come from real data, both geometry and textures, and it’s rough with some overarching rocks and a non-optimal mesh, so a height map would probably not work well.

There are two possible camera views:

  • over water, where you can see the entire island. You won’t go on the island, only see it from a boat. While it’d be nice to see underwater, I can also accept a solution that you can’t see underwater, only the ocean water reflecting the sky.
  • under water. You’ll have limited visibility (a radius of some 20m), so anything farther than that can be culled trivially. The over water island could be entirely hidden as well if necessary, or perhaps rendered as a very simplified model with extreme culling as well.

I’m thinking the dynamic terrain extension might be good for the over water island. I read some posts of people trying to tile terrains and render tiles, which would be a fine strategy here but having problems with the seams at the borders.

People will dive in the software, so I’m worried with having a large pause once their views change from under/over water.

I will need an ocean “sky”. Since it will also be limited by the 20 meter radius, I thought it might be easier to have a small plane mesh fixed to the camera in the XZ plane with a constant Y, whose UV coordinates depend on the XZ position. Any thoughts?

Finally, I’d also like to handle this in smartphones, so strategies to reduce the memory footprint would be welcome, as well as perhaps having LOD loaded not only according to distance but to performance and available memory.

What tips do you have? Anyone who implemented this already can tell me about problems you had in similar scenarios? Any PG or code that I could take a look, or even running demos?

BTW, the resulting code will be released as open source.

There is this:
http://felixpalmer.github.io/lod-terrain/presentation/

There is this:
http://www.babylonjs-playground.com/#f00M0U#39 that needs to be refined if you are gonna use it.

I think @JCPalmer had a terrain thing too unless I’m getting him mixed up with someone.

Basically any standard method will work you will just have to work up the system as we do not have a “set” method for it.

Babylon js is a webGL rendering tool, not really a level design system or game editor etc. you have to kinda script that functionality yourself or convert from other engines. There is lots of people that have examples of how to do it though.

2 Likes

Thanks, not me. One trick I did do in regards with a terrain, though, is I made the overall terrain in the shape of a circle, and added that generated skybox wt movable sun.

That way the edge of the terrain cannot be seen, because of the lack of corners. Here is the scene. The mountain is blender generated, and floor is crude, but I was really testing animation & it was 2017. Some parts are broken, but you cannot see any corners.

Thanks @Pryme8. Your links are helpful and the sort of thing I had in mind. They could work well for the underwater area. But I was wondering if perhaps the octree implementation as long as I tiled the ground into different meshes (perhaps GroundMesh could be helpful?), or the Dynamic Terrain extension could be better than implementing a tile engine from scratch.

@jerome, you seem to be the person who implemented Dynamic Terrains, could you throw your two cents please?

@brunobg : Well here is and example of a terrain that probably meets that requirement - not finished the whole scene though. The terrain was created with an Ordinance Survey Map and quads created where the sea is were deleted and replaced with a simple plane. It used the mix material javascript file to texture the terrain.from a splat map.

Flannan1

The sky is a spherical dome.with some fog added.

The actual place is “The Flannan Islands” of the coast of Scotland. The scene of a mysterious disappearance in the eatly 1900s

You could load two files - one above, one under the water. While above the water, you hide all the below water meshes, and when below the water, you hide all the above water meshes. It would really depend though on how you transfer between the two states.

Hope that helps in someway

As for @Pryme8 and his connecting @JCPalmer to terrains - I think he might mean Felix Palmer

See video here of that Mr. Palmer talking about his terrain.js script.

cheers, gryff :slight_smile:

Thank you @gryff. This is more or less what I’m looking for, but your scene seems to have much fewer polygons than I’m expecting, particularly underwater. I’m expecting a model in the 15M polygon range, which is more or less a 10cm precision, plus some other much smaller models. A desktop might handle that but I’m worried it will be too much for a phone, even more in stereo.