bevyengine / bevyengine/bevy

`bevy_render` without `bevy_core_pipeline` creates unnecessary `CameraRenderGraph` requirement

Open
#23,858 0 comments 2 reactions 0 assignees View on GitHub
A-Rendering C-Bug D-Straightforward S-Ready-For-Implementation X-Uncontroversial
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

Writing a custom renderer for Bevy, but wanting to still use `bevy_render` creates an unnecessary problem. When running your project, you will get a warning:

```md
Entity x has a `Camera` component, but it doesn't have a render graph configured. Usually, adding a `Camera2d` or `Camera3d` component will work.
However, you may instead need to enable `bevy_core_pipeline`, or may want to manually add a `CameraRenderGraph` component to create a custom render graph.
```

This is because `bevy_render::camera::extract_cameras` extracts the schedule from it and adds it to `ExtractedCamera`. However, as far as I can tell, this is only ever *used* by bevy_core_pipeline (`bevy_core_pipeline::schedule::camera_driver`), which adds a system to run that schedule.

So in order to get your renderer running, you need to either:
1. Create a dummy schedule and add `CameraRenderGraph` to your camera.
2. Copy `camera_driver` into your own code, so you could take advantage of the schedule idea.

# Solutions

I think there are two options:
1. Move `CameraRenderGraph` and its extraction into `bevy_core_pipeline`. Requires changing the signature of `ExtractedCamera`, and any code that was using that field would need to adapt as well.
2. Move `camera_driver` into `bevy_render`. Shouldn't really change anything for users, other than those who did copy that system into their own code, for whom the schedule would now run twice.

Personally, I have no preference. I think option 2 would be easier to implement and migrate.

An idea that would be the least impactful would be to add a dummy schedule on the `bevy_render` side, then replace it in `bevy_core_pipeline`, but AFAICT, required components don't support that option.

*Possibly related: #18423*

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.