I have created a map for my game Morterra, where it loads in the map via a bitmap image, using CreateGroundFromHeightMap. The ground mesh is pretty big, with like 30k vertices (22 zones * 8 subdivisions in each zone, squared), and then that mesh is instanced 8 more times (9 total meshes), because the world is artificially spherical (when you approach the edge, it will show you the opposite edge, and when you cross it will teleport you to the other side of the map. It needs to look seamless, so the map has to line up on the edges). I originally tried using dynamic terrain to achieve this, because it seems that it automatically handles LOD, which would be useful performance wise. I had issues working with Dynamic Terrain, so I eventually gave up and just instanced the ground. I figured that the faces that are outside of the frustum wouldn’t be drawn anyways, so it wouldn’t be a huge impact performance wise. It isn’t a huge impact, but I can notice it, and I’m trying to think of the best way to approach the problem.
Here’s a playground showing what I’m currently doing. It runs at 60 fps for me (with a decent GPU), but with a ton of game meshes included it can effect FPS for my computer by like 5-10 fps.
Playground: Babylon.js Playground
I do also need to be able to use the function (or an equivalent) to ground.getHeightAtCoordinates() efficiently
I think ideally I would have an array of vertices from the bitmap, and then as the player moves throughout the world, it will only show the local (3 zones * 8 subdivisions) * (3 zones terrain * 8 subdivision) = 576 total terrain vertices. I think the best way to achieve this is with Dynamic Terrains, but I’m not 100% sure.
I’m hoping to have a clear idea I’m working towards before taking on the task, so if anyone has any insight on the best ways to achieve something like this, I would greatly appreciate it!