I am developing a real time tactics game, currently capable of supporting up to 30,000 animated 3D soldiers fighting in 1,200 units. However, this was not possible using out-of-the box Godot functionality which leads to the next section
Describe the problem or limitation you are having in your project
The out-of-the-box Godot functionality to tackle this task of animating tens of thousands of 3D soldiers would initially be a MeshInstance3D and AnimationPlayer pair for every single soldier. However, this would result in massive CPU and GPU time spent both submitting draw calls and computing skeletal mesh animation. The next attempt would be to use MultiMeshInstance3D, but it lacks direct AnimationPlayer integration and can only render one mesh anyway. Thus, it's not possible to easily animate a large number of 3D meshes unless significant work is done.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The feature is based off of the GPU vertex animation tooling I've already implemented. It consists of three modules:
Defining: To define an animated 3D mesh, a VertexAnimation Resource stores three other Resources: a mesh (slime), an AnimationPlayer (slime crawl, slime squish, slime dies) compatible with that mesh, and all possible texture variations (blue slime, red slime, evil slime) for that mesh.
Baking: To convert these human-readable Resources into a GPU-friendly format, a baker script will run through every single VertexAnimation Resource and convert the three child Resources into vertex and normal textures, which will be stored in a specified folder, and their paths stored in their originating VertexAnimation resource. In addition, all possible texture variations will be combined into one Texture2DArray
Playing: A script will accept a VertexAnimation Resource and upload its vertex and normals textures, as well as the texture variations array, into a shader that is implemented to replace the vertex and normals with those stored in the array
This suite of tools and scripts solve the following problems:
It makes animating tens of thousands or even more 3D meshes possible. Vertex animations are a common optimization technique and adding this feature to Godot would enable its developers to have this many animations as an option.
It reduces time needed to implement their own GPU vertex animation solution, which is already a common pattern. I can testify that developing these tools took a stressful 3 weeks which others won't have to experience if this proposal were accepted
Here is a demonstration of the results of using these modules
If this enhancement will not be used often, can it be worked around with a few lines of script?
This feature requires some trial and error to implement the first time, costing developers many weeks for a feature that is common in game requiring many animated 3D meshes
Is there a reason why this should be core and not an add-on in the asset library?
This provides a high requested feature as seen from these posts:
The author of the last one actually managed to implement it, but hasn't shared implementation details yet, leaving curious developers in the dark. So this commonly requested feature, which is tooling to easily manage GPU vertex animations to animate tens of thousands of 3D meshes, doesn't exist at the moment. However, if it does, then developers can eliminate weeks of development time to leverage the freedom that comes with being able to animate huge numbers of 3D meshes.
This feature could also be a core feature because it relies entirely on existing Godot public API (basically, no internal calls to the engine's C++ code). This makes maintenance quite easy since nothing fancy is being done.
Describe the project you are working on
I am developing a real time tactics game, currently capable of supporting up to 30,000 animated 3D soldiers fighting in 1,200 units. However, this was not possible using out-of-the box Godot functionality which leads to the next section
Describe the problem or limitation you are having in your project
The out-of-the-box Godot functionality to tackle this task of animating tens of thousands of 3D soldiers would initially be a MeshInstance3D and AnimationPlayer pair for every single soldier. However, this would result in massive CPU and GPU time spent both submitting draw calls and computing skeletal mesh animation. The next attempt would be to use MultiMeshInstance3D, but it lacks direct AnimationPlayer integration and can only render one mesh anyway. Thus, it's not possible to easily animate a large number of 3D meshes unless significant work is done.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
The feature is based off of the GPU vertex animation tooling I've already implemented. It consists of three modules:
This suite of tools and scripts solve the following problems:
Here is a demonstration of the results of using these modules
https://www.youtube.com/watch?v=OTbQH3k0q6Q
For 5,000 critters, CPU Time is 2ms, and GPU Time is 10ms for a crowded screen
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
The above section gives an introduction to how the three modules work. Here are some code snippets or images to illustrate them in action
Uploading transform and custom data to multimesh, and limiting the number of visible instances
Shader for MultiMeshInstance3D
If this enhancement will not be used often, can it be worked around with a few lines of script?
This feature requires some trial and error to implement the first time, costing developers many weeks for a feature that is common in game requiring many animated 3D meshes
Is there a reason why this should be core and not an add-on in the asset library?
This provides a high requested feature as seen from these posts:
https://forum.godotengine.org/t/how-to-instance-animations/46857 https://godotforums.org/d/19323-anyone-have-luck-with-implementing-gpu-instancing https://www.reddit.com/r/godot/comments/8d54yy/anyone_have_luck_with_implementing_gpu_instancing/ https://www.reddit.com/r/godot/comments/11d0iot/15000_zombies_rendered_in_godot_on_my_macbook/
The author of the last one actually managed to implement it, but hasn't shared implementation details yet, leaving curious developers in the dark. So this commonly requested feature, which is tooling to easily manage GPU vertex animations to animate tens of thousands of 3D meshes, doesn't exist at the moment. However, if it does, then developers can eliminate weeks of development time to leverage the freedom that comes with being able to animate huge numbers of 3D meshes.
This feature could also be a core feature because it relies entirely on existing Godot public API (basically, no internal calls to the engine's C++ code). This makes maintenance quite easy since nothing fancy is being done.