Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan: MeshInstance3D looses Shader Instance Uniform Color when loaded with a new mesh #58113

Closed
JoanPotatoes2021 opened this issue Feb 14, 2022 · 2 comments · Fixed by #74349

Comments

@JoanPotatoes2021
Copy link

Godot version

v4.0.alpha2.official [79077e6]

System information

Windows 10

Issue description

Changing the mesh of a MeshInstance3D breaks any colorUniform from the shader assigned with Instance Uniform qualifier. While we can still print it's color value.

ShaderUniformBreakMeshLoad

Editing texturesUniform parameters not instance qualified works fine, but instance uniform colors seems to go black and not respond to any further parameter edits.

Steps to reproduce

1 Create a shader material and assign a color instance uniform to it.
2 Change the MeshInstance3D by doing load(another_mesh_path)
3 Color instance uniforms are perpetually black.

Minimal reproduction project

LoadingMeshBreaksInstanceUniform.zip

@Calinou Calinou added this to the 4.0 milestone Feb 14, 2022
@Calinou Calinou changed the title MeshInstance3D looses Shader Instance Uniform Color when loaded with a new mesh Vulkan: MeshInstance3D looses Shader Instance Uniform Color when loaded with a new mesh Feb 14, 2022
@GNSS-Stylist
Copy link
Contributor

Stumbled upon this same issue and almost created a new issue, but found this so adding my findings here instead:
Video:

2023-02-13.22-33-10.mp4

Funnily OBS didn't seem to grab the popups when selecting a new mesh nor when changing colors...

First I also stumbled upon this issue when working with MeshInstance3D, but this also affects CSGShape3Ds, so the problem might be inherited from GeometryInstance3D(?) It also seems to affect also other types of instance uniforms (or at least floats) in addition to color.

It doesn't matter if changing the geometry is done in inspector, running the project or tool script. In MRP I tried several different workarounds (like storing/restoring a duplicated material and the value of the instance uniform) to no avail. I left these with some other tests into MRP so they can be used in tests if found useful.

Last issue mentioned in the video (values of instance uniforms changing to defaults when shader compilation fails) seems to actually be duplicate of #64057

My MRP:
MeshInstance3DUpdateBug.zip

Godot version: v4.0.rc.custom_build [4a2c217]

@clayjohn clayjohn modified the milestones: 4.0, 4.x Feb 13, 2023
@JohanAR
Copy link
Contributor

JohanAR commented Mar 4, 2023

I think I've fixed it. Just need to make sure I don't break anything else before submitting PR.

@akien-mga akien-mga modified the milestones: 4.x, 4.1 Mar 4, 2023
joao-pedro-braz pushed a commit to joao-pedro-braz/godot that referenced this issue Mar 11, 2023
JeffVenancius pushed a commit to JeffVenancius/godot that referenced this issue Mar 13, 2023
YuriSizov pushed a commit to YuriSizov/godot that referenced this issue Mar 14, 2023
hakro pushed a commit to hakro/godot that referenced this issue May 21, 2023
krokoschlange pushed a commit to krokoschlange/godot that referenced this issue May 25, 2023
haunted-loaf pushed a commit to haunted-loaf/godot that referenced this issue Jun 19, 2023
TheSecondReal0 pushed a commit to TheSecondReal0/godot that referenced this issue Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants