Open Selene-Amanita opened 1 year ago
There are two worlds: main world, and render world.
PbrBundle
What happens when you call Assets<Image>.get_mut()
is that the asset is marked as changed, and will be extracted again to the render world. As the actual image was never retrieved from the render world to the main world, this is image is still just black in the main world. Also, the change on the image asset is not propagated to the standard material asset which is the one actually displayed.
What fo you expect to be able to do by calling get_mut
on the asset?
@mockersf I'm not 100% sure I understood that explaination (by "extracted", do you mean "cloned" and that there are actually two images?) but more details just in case:
get_mut
only once, the same thing still happensget_mut
get_mut
, it should either not have this behaviour, or it should warn against it somewhere in the documentation somehow and provide an alternative (maybe at RenderTarget::Image
or StandardMaterial.base_color_texture
depending on which one triggers this render world extraction of the image? And maybe in the render to texture example? And maybe in a shader example using a texture?)In case somebody finds this: it is possible to properly update the image by "touching" the material (materials.get_mut(handle)
) too: https://discord.com/channels/691052431525675048/1150171576474554468
This is likely waiting on https://github.com/bevyengine/bevy/pull/5080 to be fixed
Bevy version
v0.10.1
What you did
Render a camera to an image, use that image as a texture of a mesh, use
Assets<Image>
'sget_mut
on the handle of that imageWhat went wrong
The texture stops updating
Minimal code to reproduce
Comment/uncomment lines
Additional information
Discord threads (potentially) related:
Potential relevant system information
AdapterInfo { name: "Intel(R) Xe Graphics (TGL GT2)", vendor: 32902, device: 39497, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 22.2.5", backend: Vulkan }