You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
The demo code is too brittle to use as reference material. A scene change or scene reload cleans up the texture but does not rebind it. If you add another blank scene to the demo, open the main scene and look at the pretty texture, change tab to the new scene then reopen the main scene the texture will be blank and you wont see any ripples.
I traced the issue to the Texture2DRD not surviving the scene change/reload event. You can fix it by doing the following:
At the end of the exit tree request ready refire so that the scene will rebuild the freed textures:
func_exit_tree():
...
request_ready()
Finally make the new Texture2DRD object in _initialize_compute_code:
func_initialize_compute_code(init_with_texture_size):
# As this becomes part of our normal frame rendering,# we use our main rendering device here.rd=RenderingServer.get_rendering_device()
# Create a new texturetexture=Texture2DRD.new()
With these changes I can smoothly reload a scene and not have the compute shader fail.
Another QoL side note, include RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT on the tf usage bits so you can preview the texture in the editor.
The text was updated successfully, but these errors were encountered:
Seems fine to improve on this, I wonder if it would be better to leave things we only need to do once in _ready and move some of the code into _enter_tree so it is rerun. It really is only an editor issue I guess.
Either way, I'm happy for a PR for the improvement.
Which demo project is affected:
water_plane
OS/device including version:
Godot v4.4.dev.mono (e9504b662) - Windows 10.0.19045 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 31.0.15.3742) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 threads)
Issue description:
The demo code is too brittle to use as reference material. A scene change or scene reload cleans up the texture but does not rebind it. If you add another blank scene to the demo, open the main scene and look at the pretty texture, change tab to the new scene then reopen the main scene the texture will be blank and you wont see any ripples.
I traced the issue to the Texture2DRD not surviving the scene change/reload event. You can fix it by doing the following:
At the end of the exit tree request ready refire so that the scene will rebuild the freed textures:
Finally make the new Texture2DRD object in _initialize_compute_code:
With these changes I can smoothly reload a scene and not have the compute shader fail.
Another QoL side note, include RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT on the tf usage bits so you can preview the texture in the editor.
The text was updated successfully, but these errors were encountered: