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
When referencing a built-in matrix (MODEL_MATRIX, VIEW_MATRIX...) within the light() function of a spatial shader, these errors are thrown per renderer:
Forward+:
- servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:171 - Condition "!shader_singleton->shader.version_is_valid(version)" is true.
Mobile:
- servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp:182 - Condition "!shader_singleton->shader.version_is_valid(version)" is true.
The shader displays a fallback instead of what's written. This can be avoided by defining a variable that is identical to the matrix and referencing that instead:
In a spatial shader, reference any built-in matrix within the light function:
shader_type spatial;
void light() {
DIFFUSE_LIGHT += ATTENUATION; // lighting that should be displayed
MODEL_MATRIX; // breaks the shader, displays a fallback
}
Looks like the rest of the matrices need to be renamed in the light function. This comes from the uniform for the matrices using a different name from what the shader compiler maps onto.
For example, here is what is done in the GLES3 renderer's fragment function:
Godot version
4.0.2.stable.official
System information
Windows 10, NVIDIA GeForce RTX 2080 SUPER, Driver 516.94, Vulkan backend
Issue description
When referencing a built-in matrix (MODEL_MATRIX, VIEW_MATRIX...) within the light() function of a spatial shader, these errors are thrown per renderer:
Forward+:
Mobile:
Compatibility (MODEL_MATRIX is referenced):
The shader displays a fallback instead of what's written. This can be avoided by defining a variable that is identical to the matrix and referencing that instead:
Steps to reproduce
In a spatial shader, reference any built-in matrix within the light function:
Minimal reproduction project
issue_light_matrices.zip
The text was updated successfully, but these errors were encountered: