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
I already have a possible PR incoming to fix this issue, but I'm creating this report in case the fix needed is more complex.
Unlike normal shader uniforms set using ShaderMaterial.set_shader_parameter(), instance uniforms set using GeometryInstance3D.set_instance_shader_parameter() are is some situations updated one or more frames later. This causes all kinds of headaches as you have to add a sentinel value check (or some other similar workaround) to your shaders to see if the instance uniform has been updated yet.
Steps to reproduce
Download the MRP project and run it (it's a modified MRP from #79167 where I noticed this issue). Press and hold left mouse button and you can "paint" and create new cubes on the ground where the raycast hits. Note that all newly created cubes have a black color during their first frame of lifetime. After the first frame their instance uniform is updated and the cube gets it's real color. Hopefully, this should be pretty easy to see when dragging the mouse.
Godot version
Godot v4.2.dev (57919be)
System information
Godot v4.2.dev (57919be) - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 970 (NVIDIA; 31.0.15.3179) - Intel(R) Core(TM) i7-4790K CPU @ 4.00GHz (8 Threads)
Issue description
I already have a possible PR incoming to fix this issue, but I'm creating this report in case the fix needed is more complex.
Unlike normal shader uniforms set using
ShaderMaterial.set_shader_parameter()
, instance uniforms set usingGeometryInstance3D.set_instance_shader_parameter()
are is some situations updated one or more frames later. This causes all kinds of headaches as you have to add a sentinel value check (or some other similar workaround) to your shaders to see if the instance uniform has been updated yet.Steps to reproduce
Download the MRP project and run it (it's a modified MRP from #79167 where I noticed this issue). Press and hold left mouse button and you can "paint" and create new cubes on the ground where the raycast hits. Note that all newly created cubes have a black color during their first frame of lifetime. After the first frame their instance uniform is updated and the cube gets it's real color. Hopefully, this should be pretty easy to see when dragging the mouse.
Minimal reproduction project
InstanceUniformUpdateBug.zip
The text was updated successfully, but these errors were encountered: