Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
TerraMeshAsync
Removes the ~2 s freeze when TerraMesh (used by UniversalRadar's contour maps) converts terrain on landing. Builds a low-detail mesh instantly and swaps in full detail from a background thread.
By CELLO_Dev
| Last updated | 2 weeks ago |
| Total downloads | 153 |
| Total rating | 0 |
| Categories | BepInEx Client-side Performance AI Generated |
| Dependency string | CELLO_Dev-TerraMeshAsync-1.0.0 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2305README
TerraMeshAsync
Removes the freeze when TerraMesh converts a moon's terrain to a mesh on landing. UniversalRadar uses that conversion for its contour maps. On large terrains like March or Adamance, it takes about 2 s.
How it works
TerraMesh.Meshify(terrain, config)normally triangulates the whole heightmap on the main thread. TerraMeshAsync returns a low-detail mesh instead, built in about 60 ms.- It triangulates the full-detail mesh on a background thread, the same way TerraMesh's own
MeshifyAsyncdoes. - When the full mesh is ready, usually a couple of seconds later, TerraMeshAsync writes it into the same
Meshobject. Anything that holds that mesh picks up the full detail, including UniversalRadar's radar copies.
Measured on Adamance, the 2.2 s freeze became 60 ms + 47 ms on the main thread.
Notes
- The contour map looks a little blocky for the first couple of seconds after landing.
- UniversalRadar reads the terrain's height range from the first mesh it gets. The low-detail mesh's range is within about 0.3% of the full one, so the contour shading looks the same.
- The final swap skips
Mesh.Optimize, which only reorders vertices for the GPU's cache. That keeps the swap frame short. - TerraMeshAsync runs on your game only and only changes visuals. Other players don't need it.
- If TerraMesh's internals change, TerraMeshAsync logs a warning and leaves the conversion as it is.
Log
Your log will show lines like these:
[Info :TerraMeshAsync] AdamanceTerrain: low-detail mesh in 60 ms, full detail building in the background
[Info :TerraMeshAsync] AdamanceTerrain: full-detail mesh in place after 2.7 s (47 ms on the main thread)