I want to have one custom material+mesh that's instanced (potentially) millions of times, which then varies it's shading behaviour based on data in components attached to the per-instance entities.
From what I can tell, the only ways to do this are:
- Create a new CustomMaterial component for every single instance and put my custom per-instance data in that. Which seems like it's going to preform badly
- Use
MeshTagto look up the per-instance data in aShaderStorageBuffer. But then I need to manually manage that Storage Buffer myself, copying the data out of the ECS into the shader buffer whenever it changes (and defragging the Storage Buffer when instances are destroyed and created)
I feel like I'm missing something. Feels like there should be a way for Bevy to do this automatically, without me having to worry about manually managing storage buffers.