#Changing camera's RenderTarget on runtime

4 messages · Page 1 of 1 (latest)

versed robin
#

I've checked out the example of rendering from a camera to an Image handle. I've done it, works quite nicely, but I have setup sort of like a scene to create these images, and I spawn items in front of the camera, create an Image handle, then some time in the future, despawn the items in front of the camera and repeat the process, and it seems to be writing to the Image buffer All of the previously spawned items, even though they aren't even present in the game world.

#

Is it a bug or am I doing something wrong? Should I be using 1 camera per render target?

rich ermine
# versed robin I've checked out the example of rendering from a camera to an Image handle. I've...

It sounds like you may be rendering over and over to the same image texture, without clearing it. That could appear as though all the objects were still present.

Here’s an example implementation of generating thumbnails for gltf scenes. It may help you see what you’re doing differently. https://github.com/dmlary/bevy-hex-sandbox/blob/570a6d9cf46c2729187c830dc7e84ec613533024/src/thumbnail_render.rs#L73

versed robin
#

@rich ermine Sorry for the late reply. I haven't been able to resolve the issue, and I looked at your code and it doesn't look any different from what I'm doing, except changing the rendertarget in the update system instead of doing it from the start.

If you find the time check out what I'm doing in the issue that I posted in the Bevy github repo:

https://github.com/bevyengine/bevy/issues/11844

Thank you for your time!

GitHub

Bevy version bevy = { version = "0.12.1" } Relevant system information cargo 1.77.0-nightly (1ae631085 2024-01-17) AdapterInfo { name: "Apple M1 Pro", vendor: 0, device: 0, devi...