`Text2dBundle` should have `Material` field
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
To my knowledge, there is no easy way to add a `Material` to `Text` or `Text2dBundle`. This makes interesting alterations to the text more difficult, such as in [this](https://codepen.io/mochathoughts/pen/QWoZOWw) example where Perlin noise & a displacement map "animate" the text. I have yet to find a way to achieve a similar effect on `Text` using bevy.
## What solution would you like?
Add a `Material` to Text2dBundle, with a sensible default most people shouldn't even notice the change if they weren't using it. An example:
```rust
commands.spawn(Text2dBundle {
text,
material: materials.add(/* Your material here */),
..default()
});
```
## What alternative(s) have you considered?
It's possible you can render the text in a separate application, and apply shaders to that image. This isn't ideal for a couple reasons, the biggest being that you cannot change text on the fly based on context due to the requirement that it be an `Image`.
I will say, I am new to the Bevy ecosystem and it may be that there's an obvious alternative I didn't see. If so, my apologies for the redundant issue.
## Additional context
I did a little digging, and adding this myself is unfortunately out of my scope of knowledge. Looks to me like `extract_text2d_sprite` might be a good place to start, as that's what actually adds the text to the "render world" as the doc put it. Not sure how trivial, if it even is trivial, of an addition this would be though.
Contributor guide
Assessment
This issue has not been assessed yet.