The difference between Zylann's terrain plugin and custom-created meshes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By WatcherMagic

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.

Hey everyone!

When it comes to the difference between Zylann’s terrain plugin and custom-created meshes in Godot, there are a few key factors to consider.

Zylann’s terrain plugin is a great tool for creating diverse terrains with features like caves and overhanging cliffs. It provides a convenient way to generate terrain procedurally, saving you time compared to manually creating custom terrain models in Blender. The plugin offers various optimizations and LOD (Level of Detail) techniques to ensure good performance, even with large terrains.

In terms of performance, using Zylann’s terrain plugin can be more efficient compared to a standard mesh, especially when dealing with terrains of significant size. The plugin utilizes techniques like level of detail culling and terrain chunking, which allow you to load/unload specific portions of the terrain based on visibility. This can significantly improve overall performance by decreasing the number of vertices that want to be rendered at any given time.

However, it’s essential to note that the overall performance impact relies upon on various elements such as the complexity of the terrain, the hardware specifications of your goal platform, and how you handle the loading/unloading of terrain chunks.

So, if you’re aiming for efficient terrain rendering with features like LOD and dynamic loading/unloading, Zylann’s terrain plugin is definitely worth checking out. It can provide a more optimized solution compared to manually creating and managing custom meshes for your terrains.

angelacow | 2023-05-15 11:48

:bust_in_silhouette: Reply From: gmaps

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.

Thank you very much!

WatcherMagic | 2019-10-07 21:02

:bust_in_silhouette: Reply From: Saitodepaula

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.