Revolutionary-Games / Thrive

The main repository for the development of the evolution game Thrive.
https://revolutionarygamesstudio.com/
Other
2.71k stars 490 forks source link

Investigate if cell (organelle) graphics can be rendered using MultiMesh #3709

Open hhyyrylainen opened 1 year ago

hhyyrylainen commented 1 year ago

Investigate if changing all organelle rendering (and maybe membrane rendering as well if possible) to use MultiMesh improves performance a lot. MultiMesh is basically the high level way to use instanced rendering in Godot which basically allows us to just set the positions and few other parameters per instance of a mesh and then Godot will only use one draw call to render all of them. This way organelles are not separate Godot nodes which may massively improve performance.

Before trying this it is probably worth it to check: https://github.com/Revolutionary-Games/Thrive/issues/3646

Related to: https://github.com/Revolutionary-Games/Thrive/issues/3016

Zireael07 commented 1 year ago

Side note: multimeshes do NOT frustum cull, so they'd need to all be on screen to benefit, otherwise they might even lower your FPS.

On the other side, with GD4 and instance uniforms, you could probably treat them like grass or asteroids, and render thousands with small variations... Unfortunately instance uniforms aren't a thing in GD3 yet

hhyyrylainen commented 1 year ago

I'm 97% sure that GPU is not our bottleneck, the CPU performance is. So even if the GPU needs to generate and discard a bunch of vertices, it probably still is better performance.

Also good point that we might be able to save performance by doing a really simple non-visible microbe culling ourselves and only have the relevant organelles even sent to the MultiMesh.

hhyyrylainen commented 5 months ago

With the new ECS system changes, rendering all organelles of a certain type with a single multimesh is probably now much easier to do, if the there are still performance concerns that warrant trying this.