Skip to content

Add an example for stochastic texture sampling #17527

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cBournhonesque
Copy link
Contributor

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 #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!

StochasticSampling.mov

@cBournhonesque cBournhonesque added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jan 24, 2025
Copy link
Contributor

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.

@BenjaminBrienen BenjaminBrienen added D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward and removed D-Straightforward Simple bug fixes and API improvements, docs, test and examples labels Jan 25, 2025
@IceSentry
Copy link
Contributor

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.

@cBournhonesque
Copy link
Contributor Author

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?

@Mantissa-23
Copy link

Mantissa-23 commented May 22, 2025

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.

@IceSentry
Copy link
Contributor

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. bevyengine/bevy-website#2131

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Needs-Review Needs reviewer attention (from anyone!) to move forward
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

4 participants