bevyengine / bevyengine/bevy

Rendering to a texture (once) is surprisingly difficult and complicated

Open
#24,869 3 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Usability D-Complex S-Needs-Design
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

I want to generate one-time or infrequently changed textures that can then be incorporated into world rendering.

This would be useful especially for procedurally generated textures. Though in this case, making a first project and learning to use Bevy, I had wanted to render text (with some custom formatting and layout behavior) once to a reusable texture, and also to render UI views to textures, incorporating the once-rendered text, only redrawing whenever the UI (infrequently) needed an update.

I have been surprised and dismayed to find that, apparently, there is no way to leverage Bevy's very useful rendering pipeline and API outside of its normal render loop, meaning that the only options I've found for this are:

1. To do weird and complicated lifecycle management of render-to-texture cameras and entities, initializing them and waiting for them to render before the texture can be used some frames later, and the camera and entities can be cleaned up.
2. To bypass Bevy's rendering helpers entirely and build a fully new from scratch rendering pipeline targeting Bevy's wgpu device, or else initialize and render images only on the CPU.

## What solution would you like?

I'm still learning Bevy and I don't feel like I have the context to suggest a specific solution. I'm still not certain that I haven't just failed to find an already existing better solution. But it would be extremely helpful to have some API and documented pattern for using Bevy's existing rendering pipeline to render things to a texture (once) without having to wait for normal frame scheduling.

## What alternative(s) have you considered?

For the time being I am giving up on my hopes of optimizing performance by rendering text once and UI only when it's updated, and just keeping around a bunch of entities instead.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Bevy's normal render loop and the wgpu device path mentioned in the issue; no specific files or tests are identified. A complete solution would provide an API and documented pattern for rendering once or infrequently to a reusable texture without waiting for normal frame scheduling.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.