Gizmos render unreliably
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version and features
Cargo.toml
```
[package]
name = "asd"
version = "0.1.0"
edition = "2024"
default-run = "asd"
[dependencies]
bevy = { version = "0.18.0-rc.2", default-features = true}
[profile.dev]
debug = true
incremental = true
```
**but also tested at 0.17.3 with the same results**
## Relevant system information
```ignore
INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce RTX 5070 Ti", vendor: 4318, device: 11269, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "591.59", backend: Vulkan }
```
## What you did
Basically rendering a gizmo with and without any other gizmos rendered at this frame.
See the code example on the bottom.
You can use A/S keys to draw a gizmo for a single frame, and the D button enables a constant all frame gizmo.
## What went wrong
When i render a gizmo for a single frame (e.g. on button pressed), the gizmo does not appear, **unless** you also have another gizmo that was already rendering at the previous frame.
The gizmos get drawn every time, when you click the D button, and the constant gizmo gets drawn as well.
## Additional information
Code to reproduce:
```rust
use bevy::{input::keyboard::KeyboardInput, prelude::*, window::PresentMode};
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(bevy::log::LogPlugin {
filter: "bevvy_rust=debug".to_string(),
level: bevy::log::Level::INFO,
..default()
}).set(WindowPlugin{
primary_window: Some(Window {
present_mode: PresentMode::AutoVsync,
..Default::default()
}),..Default::default()
})).add_systems(Startup, setup_camera)
.add_systems(Update, (draw_a, draw_b, draw_c, draw_d))
.run();
}
fn draw_a(mut gizmos: Gizmos, keyboard_input: Res>) {
if keyboard_input.just_pressed(KeyCode::KeyA) {
let color = Color::srgb(0.3, 0.5, 0.7);
gizmos.arrow(Vec3::new(3.0, 3.0, 3.0), Vec3::new(3.0, 0.0, 0.0), color);
println!("drawing a");
}
}
fn draw_b(mut gizmos: Gizmos, keyboard_input: Res>) {
if keyboard_input.just_pressed(KeyCode::KeyS) {
let color = Color::srgb(0.3, 0.3, 0.7);
gizmos.arrow(Vec3::new(0.0, 3.0, 0.0), Vec3::new(3.0, 0.0, 0.0), color);
println!("drawing b");
}
}
fn draw_c(mut gizmos: Gizmos, keyboard_input: Res>, time: Res
let color = Color::srgb(0.2, 0.5, 0.2);
gizmos.sphere(
Isometry3d::from_translation(Vec3::new(3.0, 1.0, 3.0)),
3.0,
color,
);
println!("drawing d");
}
}
fn setup_camera(mut commands: Commands) {
commands.spawn((Camera3d::default(),
Transform::from_xyz(10.0, 10.0, 10.0)
.looking_at(Vec3::ZERO, Vec3::Y),
) );
}
```
Contributor guide
Research direction
Start by running the provided Rust reproduction with Bevy 0.18.0-rc.2 or 0.17.3, then use the A, S, and D keys to compare single-frame gizmos with the persistent gizmo. Trace the gizmo rendering path implicated by the reproduction; done means frame-only gizmos appear reliably even when no gizmo was rendered in the previous frame.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100