Skip to content
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

Add many_materials stress test #17346

Merged

Conversation

CrazyRoka
Copy link
Contributor

@CrazyRoka CrazyRoka commented Jan 13, 2025

Objective

Solution

  • Created a new example (examples/stress_tests/many_materials.rs) that renders a grid of cubes with animated materials.
  • The size of the grid can be configured using the -n command-line argument (or --grid-size). The default grid size is 10x10.
  • The materials animate by cycling through colors in the HSL color space.

Testing

  • I have tested these changes locally on my Linux machine.
  • Reviewers can test the changes by running the example with different grid sizes and observing the performance (FPS, frame time).
  • I have not tested on other platforms (macOS, Windows, wasm), but I expect it to work as the code uses standard Bevy features.

Showcase

Click to view showcase

image

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.

Copy link
Contributor

@greeble-dev greeble-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Windows/Nvidia with no issues. Added a few non-blocking suggestions.

examples/stress_tests/many_materials.rs Outdated Show resolved Hide resolved
examples/stress_tests/many_materials.rs Outdated Show resolved Hide resolved
examples/stress_tests/many_materials.rs Outdated Show resolved Hide resolved
@IQuick143 IQuick143 added A-Rendering Drawing game state to the screen C-Examples An addition or correction to our examples C-Benchmarks Stress tests and benchmarks used to measure how fast things are D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 15, 2025
- Removed ground plane as it was unnecessary.
- Adjusted camera position for a better view.
- Reused mesh handle to improve performance.
- Regenerated examples README using `cargo run -p build-templated-pages -- update examples`.
@CrazyRoka
Copy link
Contributor Author

I've addressed the feedback in a new commit. Please take another look when you have time. Thanks!

@greeble-dev
Copy link
Contributor

Re-tested with the changes. Looks good!

@BenjaminBrienen BenjaminBrienen added S-Needs-SME Decision or review from an SME is required and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jan 21, 2025

// Cubes
let mesh_handle = mesh_assets.add(Cuboid::from_size(Vec3::ONE));
for x in 0..n {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to make this 3 dimensional if frustum culling interacts with this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, nevermind, I didn't realize the camera was adjusted to fit everything on screen when I made that comment.

}
}

fn animate_materials(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be good to have a runtime toggle for this. Like pressing spacebar.

This way we can more easily confirm that it's the animation that is the issue and not rendering.

@IceSentry IceSentry added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-SME Decision or review from an SME is required labels Jan 21, 2025
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Jan 24, 2025
Merged via the queue into bevyengine:main with commit af3a84f Jan 24, 2025
34 checks passed
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-Benchmarks Stress tests and benchmarks used to measure how fast things are C-Examples An addition or correction to our examples D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add a stress test for animating materials
7 participants