godotengine / godotengine/godot
Renamed Shader Uniforms Cannot Be Accessed Via get_shader_parameter()
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in v4.6.stable.official [89cea1439]
### System information
Windows 11, Intel(R) Core(TM) i7-10870H CPU, NVIDIA, GeForce RTX 3060 - driver verison 32.0.15.9186, forward_plus renderer
### Issue description
`get_shader_parameter()` returns `` if a shader unifrom value is renamed. I have noticed that this is more likely to happen if the shader material is attached to a mesh resource imported from a .glb file.
### Steps to reproduce
Create a scene with a MeshInstance3D that uses an ArrayMesh derived from an imported .glb mesh. Attach a shader material to the mesh and create a shader that contains a uniform such as: `uniform vec4 albedo_color : source_color;`. Create a GDscript and attach it to a node in the current scene. Write a line of code that returns the value of the uniform such as:
```
func _ready() -> void:
print($MeshInstance3D.get_active_material(0).get_shader_parameter("albedo_color"))
```
Edit the name of the shader uniform to something else and save the shader. Go back to the GDscript and update the script to reflect these changes. Try to run the game and the shader uniform will return a `` value.
### Minimal reproduction project (MRP)
[ShaderParamIssue.zip](https://github.com/user-attachments/files/25330431/ShaderParamIssue.zip)
Contributor guide
Assessment
This issue has not been assessed yet.