bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.23k stars 3.57k forks source link

Implement instancing render pipeline base on material pipeline #7147

Open Parallel-Paradox opened 1 year ago

Parallel-Paradox commented 1 year ago

What problem does this solve or what need does it fill?

Currently the GPU instancing in bevy can only be implemented in a very low level abstraction: official example.

If you try to integrate some assets from material plugin, RenderCommand SetMaterialBindGroup<M, I> for example, it won't run properly as the systems that extract and prepare data for this command are private and can't be accessed.

What solution would you like?

Extend material pipeline or provide a new pipeline base on it. Make instancing can be implemented in an easier way, just like normal material plugin did.

What alternative(s) have you considered?

At least public material data preparation related system and component so that I can create a plugin to hide the complexity myself.

Additional context

All change can be scoped in material.rs in bevy_pbr, I guess.

Parallel-Paradox commented 1 year ago

My minimal requirement is making SetMaterialBindGroup a more general render command that can be used in custom draw command.

Still example, the RenderMaterials<M> here is prepared by this private system, which makes I'll have to copy everything related to make this command work outside this mod.