-
In my game I need to apply a post-processing effect when the player uses a power-up. I based my post-processing around the official example from the Bevy repository. Is it possible to switch shaders during runtime / turn them on/off? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Yes, it should be possible. In the example there's the If you want to apply a different effect, you'll need different materials (just another type different than You'll also need multiple entities with different When it's time to apply a different effect, despawn the entity with the the I think it should work, but let me know if it doesn't. Good luck! |
Beta Was this translation helpful? Give feedback.
Yes, it should be possible.
In the example there's the
post_processing_pass_layer
component that is used to mark theCamera2dBundle
andMaterialMesh2dBundle
.If you want to apply a different effect, you'll need different materials (just another type different than
PostprocessingMaterial
in the example, that derivesAsBindGroup
and implementsMaterial2d
, pointing to the correct shader).You'll also need multiple entities with different
MaterialMesh2dBundle
s, one for each material (one material per effect).When it's time to apply a different effect, despawn the entity with the the
MaterialMesh2dBundle
that is currently applied, and spawn a new entity with the new material for the new effec…