StarArawn / bevy_ecs_tilemap

A tilemap rendering crate for bevy which is more ECS friendly.
MIT License
943 stars 198 forks source link

Blending modes for rendering #169

Open inodentry opened 2 years ago

inodentry commented 2 years ago

I want to have a layer whose tiles are used to apply visual effects to the tiles underneath, and would like to be able to set a different blending mode (for color and alpha) for wgpu to use.

I understand that this cannot be done per-tile (as many tiles are drawn with one draw call, for efficiency), but I would be happy if it was available per-layer.

Could something like this be supported?

StarArawn commented 2 years ago

I want to have a layer whose tiles are used to apply visual effects to the tiles underneath, and would like to be able to set a different blending mode (for color and alpha) for wgpu to use.

I understand that this cannot be done per-tile (as many tiles are drawn with one draw call, for efficiency), but I would be happy if it was available per-layer.

Could something like this be supported?

Yeah something like this can be supported. It's just a matter of being able to hash the necessary data for blending in order for us to build a unique render pipeline. We might need to come up with a list of all possible blend modes? I suspect that would be useful within bevy itself as well. 👍

inodentry commented 2 years ago

This is already it: https://docs.rs/wgpu/latest/wgpu/struct.BlendState.html

This struct is what is used to configure blending, and it covers all the possibilities. It impls Hash.