bevyengine / bevyengine/bevy

Multiples camera with RenderLayers doesn't work with Msaa::Off (solved ?)

Open
#15,467 5 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Needs-Investigation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

0.14.2

## \[Optional\] Relevant system information

archlinux wayland kde
`AdapterInfo { name: "AMD Radeon RX 7800 XT (RADV NAVI32)", vendor: 4098, device: 29822, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.2.3-arch1.1", backend: Vulkan }`

## What you did

i have a game with a bevy ui grid, and i wanted to draw gizmo on it. It was quite hard as the documentation is hard to find.
Based off https://github.com/bevyengine/bevy/issues/13027 i tried the example given with 2 cameras and render layer, which works with little modification, but not on my game, the gizmo are drawing but not the ui.
after hours of pain trying different things, i found it was when i had `app.insert_resource(Msaa::Off)` that the ui didn't show.
```rust
use bevy::{
color::palettes::css::{MIDNIGHT_BLUE, RED, YELLOW},
prelude::*,
render::view::RenderLayers,
};

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.insert_gizmo_config(
DefaultGizmoConfigGroup,
GizmoConfig {
render_layers: RenderLayers::layer(1),
..default()
},
)
// .insert_resource(Msaa::Off)
.add_systems(Startup, setup)
.add_systems(Update, gizmos)
.run();
}

fn setup(mut commands: Commands) {
// "Bottom" camera
let camera0 = commands.spawn(Camera2dBundle::default()).id();

// "Top" camera
let mut camera2 = Camera2dBundle::default();
camera2.camera.order = 1;
commands.spawn((camera2, RenderLayers::layer(1)));

commands.spawn((
ImageBundle {
style: Style {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
..default()
},
image: UiImage::solid_color(MIDNIGHT_BLUE.into()),
..default()
},
// use the default first camera for ui
TargetCamera(camera0),
));
}

fn gizmos(mut gizmos: Gizmos) {
gizmos.line_2d(Vec2::new(-25.0, 25.0), Vec2::new(25.0, 25.0), RED);
gizmos.line_2d(Vec2::new(0.0, 0.0), Vec2::new(0.0, 50.0), YELLOW);
}
```

## What went wrong

The gizmos are drawn, but the ui is invisible, not shown.
You can test this by un commenting the insert msaa off line in main.

thanks !

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.