Generating terrain mesh from height map vs. importing a mesh (Godot 4)

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

Hi guys –

Is there any difference in performance between generating a terrain using a heightmap image versus importing a sculpted terrain mesh into Godot? Afaik, generating a mesh in the engine will build a mesh resource anyway, ie create vertices and faces (and normals) based on the luminance value of the nearest pixel.
In 3.x it made sense because there was a plugin that had automatic LOD. But in Godot 4 which comes with a LOD system out of the box, is there any performance-related advantage of using heightmap mesh generation over importing a mesh?

:bust_in_silhouette: Reply From: Mario

I’d say no, but:

  • With heightmap image you’ll have a far easier time, if you want to dynamically adjust the landscape (explosion craters, simple digging, map editor). Also remember you can encode multiple things in the different color channels of your image (biomes, vegetation, or other ground/area related properties).

  • With a model you’re far more flexible, most notably holes and overhangs. The latter requiring extra objects if you’re using a heightmap. Encoding and querying extra properties might be more tricky, though.

Done right, both approaches should net you basically the same performance (since once in memory they’d essentially be the same with the exception of one model generated at runtime). So what to pick? I’d say that completely depends on your individual project, what’s more comfortable for you to work with, etc.