Terrain of 100x100 mesh+material = 3 fps

(Chris Howard) #1

I have a terrain / height map of 100x100 simple meshes (2 triangles each). Each mesh is assigned one of 6 pre-defined materials based on pseudo height (I am using a perlin noise fn to assign).

This all renders fine but the fps is super low - have tried under MacOS / Metal and Win10 / Vulcan - same result.

I am assuming this is down to how multiple meshes are handled / rendered.

I had considered using a single mesh (a single larger mesh with the same poly count would no doubt be less of an issue) but I am not sure how to assign different materials to different portions of the mesh.

Or is there a better approach? TiA.


I suspect that you are doing close to 10000 draw calls with your implementation hence 3 fps. In amethyst draw calls are grouped by (Handle<Mesh>, Handle<Material>) pairs so you want to have as few of these pairs as possible.

How to fix:

  • Are you calling Loader::load multiple times for the same data? That results in unique handles that can not be grouped. You have to load once and then clone() the handle for how many times you need the asset.
  • You would still have 10000 unique meshes and this is not the way to render terrain. One way is to have single large mesh that is texture tiled and blended using texture splatting (requires custom render pass). There are others ways like megatextures, but I don’t think it’s feasible to do that in amethyst.
1 Like
(Chris Howard) #3

@chemicstry thanks for the reply. I am using clone() already but agree that this still leaves a large number of unique meshes.

Sounds like texture splatting is the route I need to follow. Any pointers on doing this with Amethyst beyond copying one of the existing DrawShaded or DrawFlat options?


Implementing custom render passes with the current renderer implementation is really painful, you have to copy a lot of code. For texture splatting you also want to extend Material with a splat texture, others you can just load as texture arrays. You can see a PoC here https://github.com/chemicstry/amethyst/tree/terrain (try running terrain example).