0 votes

Hello! I'm new to Godot, and have been looking it over in relation to a project I have in mind. It's a game with significant variations in the types of terrain, particularly geometry that height maps can't provide immediately: caves, overhanging cliffs, etc.

I'd originally planned to create custom terrain models in blender with medium resolution, and to manually sculpt details from there. Then I saw Zylann's terrain plugin, and it looks fantastic! How would it compare in performance with a standard (rather large) mesh? Assume these meshes will have ~300,000 vertices or less.

I want to have multiple pieces of terrain so I can load/unload based on visibility (i.e, if you're underground surface terrain models you can't see will be unloaded, or in mountains when you can't see far off,) to save performance. I want to know if having multiple terrain files held in memory will make a difference as opposed to just holding plain meshes.

asked Oct 7, 2019 in Gossip by WatcherMagic (12 points)

2 Answers

+1 vote

Zylann's plugin is based on heightmap terrain generation - basically you don't sculpt vertices but you paint a texture from which the mesh gets dynamically created. It's great because it allows you to have multiple LOD levels. The LOD makes near surfeces detailed and far ones will have fewer vertices which is good for large terrain performance. In Zylann's plugin you can also cut holes, for the caves, cliffs - though it's not the most convenient way compared to voxels, which doesn't have a trivial LOD soloution (similar problem).

For huge terrains you could cut a huge heightmap (4096x4096) or higher into small chunks (e.g. 256x256), and then load only the ones near the player.
There already were some similar questions: question1, question2. Same approach is usually used in unity.

Zylann's terrain plugin doesn't support "mushrooming" (yet?) which would allow you to make the cliffs/caves to some extent (at least I think it doesn't, Zylann should more insights about this :)).

With current state of the Godot terrain tools I would choose to go with Zylann's plugin & holes for custom meshes.

answered Oct 7, 2019 by gmaps (692 points)
edited Oct 7, 2019 by gmaps

Thank you very much!

0 votes

I've done some tests with Zylann's HeightMap Plugin and a mesh from Blender. In the tests I've used:

  1. Blender mesh created from a SHP file, using Blender GIS. The mesh is 16 x 16 km.
  2. Heightmap (4096 x 4096 pixels PNG) for Zylann's plugin, created in QGIS, using TIN interpolation, from the same SHP imported into Blender. The terrain was 4096 x 4096 m, scaled in Godot to 16 x 16 km.

Observing a few debugging monitor values, the values were about:

  1. Blender mesh: ~5 million vertices drawn, 50-100 draw calls, 60 FPS
    and 40 MB of static memory.
  2. Zylann's plugin terrain: 200k to 500k
    vertices drawn, 180-220 draw calls, 60 FPS, 190 MB of static memory.

So, althought the Blender mesh had an order of magnitude more vertices, it generated less draw calls and less memory usage.

And the performance was actually the same in terms of FPS.

The only reason I'm not using Zylann's plugin is that I've had issues with the terrain collider, I've seen kinematic bodies and rigid bodies sometimes intersecting with the terrain for almost 1 meter (considering 1 Godot unit = 1 meter).

Screenshots from the tests:

The Blender Mesh:

enter image description here

Zylann's plugin terrain (notice the player floating, and, with the shader type Classic4, the terrain doesn't looks good).

enter image description here

Considering you talked about caves and overhangs, you should take a look at Zylann's voxel terrain module, maybe it's what your are looking for.

enter image description here

answered Dec 5, 2019 by Saitodepaula (119 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.