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

Sampler2D Shader Global causes the values of shader parameters to be reset #71789

Open
rustwork opened this issue Jan 21, 2023 · 0 comments
Open

Comments

@rustwork
Copy link

Godot version

4.0 Beta 12

System information

Windows 10, Vulkan, Nvidia RTX 3060 Ti

Issue description

If a ShaderMaterial uses a Sampler2d type global shader variable and the material is referenced in a GDscript, then the values of the material's regular shader parameters will get reset to defaults after the editor is restarted.
Note: the GDscript that references the material doesn't even have to be attached to anything.

The material on disk does still contain the parameter info such as an assigned texture, but in the editor the same parameter appears to be blank.

If the .godot folder is deleted, then the material will correctly display the parameter values temporarily but only the first time the editor is launched. Upon restarting the editor again, the parameters are blank again.

The output window does show errors about the global variable being missing from the project settings, even though it's there.

Please see below video in which I demonstrate all of this (with audio):

Global_Var_Bug.mp4

Steps to reproduce

  • Open the attached project file
  • Assign a texture and edit the shader parameters of the Mat2_Globals.tres material (assigned to the sphere on the right)
  • Save and restart the editor
  • Observe that the values of the parameters on the material are now blank

Minimal reproduction project

Global_Shader_Bug.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants