Add an example for stochastic texture sampling
Objective
This PR adds an example that showcases how a custom material can be used to repeat a texture stochastically while avoiding repetition artifacts. It is related to https://github.com/bevyengine/bevy/issues/13682.
It doesn't provide a seamless solution for users but at least it can provide an example.
I don't think it's the best implementation out there (it's my first time writing a shader and I mostly glued external code) but it seems to be working!
https://github.com/user-attachments/assets/9c2d9a50-a317-4354-9470-629e25c2ad38
The generated examples/README.md is out of sync with the example metadata in Cargo.toml or the example readme template. Please run cargo run -p build-templated-pages -- update examples to update it, and commit the file change.
I personally don't like that kind of example because it doesn't really show any bevy api that isn't already documented in another example. I think for an example like that to be included it would need to show something that requires a lot of complexe use of bevy apis, but this just shows a simple use of the mesh and material api. Most of the complexity is in the shader. If people want it despite that I won't push back more, but I just wanted to voice this.
I personally don't like that kind of example because it doesn't really show any bevy api that isn't already documented in another example. I think for an example like that to be included it would need to show something that requires a lot of complexe use of bevy apis, but this just shows a simple use of the mesh and material api. Most of the complexity is in the shader. If people want it despite that I won't push back more, but I just wanted to voice this.
I think I agree. Would we want to support this kind of behaviour in-tree or let external crates provide this kind of stuff?
I personally don't like that kind of example because it doesn't really show any bevy api that isn't already documented in another example. I think for an example like that to be included it would need to show something that requires a lot of complexe use of bevy apis, but this just shows a simple use of the mesh and material api. Most of the complexity is in the shader. If people want it despite that I won't push back more, but I just wanted to voice this.
I think the broader question here is "is it the job of Bevy documentation to teach people game development in addition to how to use Bevy?"
I would argue the answer is "yes," due in part to Bevy's popularity, but perhaps it's valuable to introduce some kind of organizational structure here, or provide this kind of thing in a "recipe book," as opposed to an example that directly demonstrates use of the engine. Because I agree, this is the kind of content that is Bevy-agnostic and could apply to pretty much any game engine.
I would argue the answer is "yes,"
I personally disagree, but that's only my personal opinion. The bevy community has decided to start merging tutorials that are aimed at more general game development in the context of bevy and not just teaching bevy itself. https://github.com/bevyengine/bevy-website/pull/2131