bevyengine / bevyengine/bevy

example "First person view model" do not render default layer

Open
#21,424 6 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug C-Examples S-Ready-For-Implementation
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version and features

```
bevy = { version = "0.17.2", default-features = false, features = [
"std",
"zstd_rust",
"async_executor",
"android-game-activity",
"android_shared_stdcxx",
"animation",
"bevy_asset",
"bevy_audio",
"bevy_color",
"bevy_core_pipeline",
"bevy_gilrs",
"bevy_gizmos",
"bevy_gltf",
"bevy_input_focus",
#"bevy_log",
"bevy_mesh_picking_backend",
"bevy_pbr",
"bevy_picking",
"bevy_render",
"bevy_scene",
"bevy_sprite",
"bevy_sprite_picking_backend",
"bevy_state",
"bevy_text",
"bevy_ui",
"bevy_ui_picking_backend",
"bevy_window",
"bevy_winit",
"custom_cursor",
"default_font",
"hdr",
"multi_threaded",
"png",
"smaa_luts",
"sysinfo_plugin",
"tonemapping_luts",
"vorbis",
"webgl2",
#"x11",
"wayland",
] }
```

## \[Optional\] Relevant system information

Probably not relevant, but for completeness:
Rust 1.90, Kubuntu 25.04, Vulkan backend, NVIDIA RTX 5080 (driver 580.82.09)

## What you did

Ran the official example
[https://bevy.org/examples/camera/first-person-view-model/](https://bevy.org/examples/camera/first-person-view-model) using Bevy 0.17.2.

## What went wrong

When running the example, the DEFAULT_RENDER_LAYER is not rendered — only the VIEW_MODEL_RENDER_LAYER is visible.

## Additional information

Adding `clear_color: ClearColorConfig::None` to the view-model camera fixes the problem:

```
parent.spawn((
Camera3d::default(),
Camera {
// Bump the order to render on top of the world model.
order: 1,
clear_color: ClearColorConfig::None, // <-- herer
..default()
},
Projection::from(PerspectiveProjection {
fov: 70.0_f32.to_radians(),
..default()
}),
// Only render objects belonging to the view model.
RenderLayers::layer(VIEW_MODEL_RENDER_LAYER),
));
```

It works after that, but I'm not sure if this is the correct way to fix it.

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.