Game Version
v2026.7.9.5018Operating System
macOSWhat Happened
With textures and shadows stored together under globalTextures, SPIRV-Cross incorrectly identifies textures2d as depth2d, causing 3 out of 4 values in vec4 to be lost. This results in incorrect clouds, planet colors, and possible issues with ground clutter.What Was Expected
Potential fix is to separate globalTextures into globalTextures and globalShadows (same goes with the arrays). If I'm not mistaken, if done in a shader, they should still point to the same objects. SPIRV-Cross, used by MoltenVK and is the reason for incorrect determination, would correctly separate the two into texture2d<float> and depth2d<float>. The change, theoretically, should be transparent to Windows/Linux usersDiff
Code:
diff --git a/Shaders/Common/TextureSet.glsl b/Shaders/Common/TextureSet.glsl
index 261a89f..8442e57 100644
--- a/Shaders/Common/TextureSet.glsl
+++ b/Shaders/Common/TextureSet.glsl
@@ -8,17 +8,19 @@
#endif
layout (set = SET_TEXTURE, binding = 0) uniform texture2D globalTextures[];
+layout (set = SET_TEXTURE, binding = 0) uniform texture2D globalShadows[];
layout (set = SET_TEXTURE, binding = 0) uniform texture2DArray globalTextureArrays[];
+layout (set = SET_TEXTURE, binding = 0) uniform texture2DArray globalShadowsArray[];
layout (set = SET_TEXTURE, binding = 0) uniform textureCube globalTextureCubes[];
layout (set = SET_TEXTURE, binding = 1) uniform sampler samplers[];
#define TEXTURE_SAMPLER(texID, samplerID) sampler2D(globalTextures[texID], samplers[samplerID])
#define TEXTURE_ARRAY_SAMPLER(texID, samplerID) sampler2DArray(globalTextureArrays[texID], samplers[samplerID])
-#define SHADOW_ARRAY_SAMPLER(texID, samplerID) sampler2DArrayShadow(globalTextureArrays[texID], samplers[samplerID])
-#define SHADOW_SAMPLER(texID, samplerID) sampler2DShadow(globalTextures[texID], samplers[samplerID])
+#define SHADOW_ARRAY_SAMPLER(texID, samplerID) sampler2DArrayShadow(globalShadowsArray[texID], samplers[samplerID])
+#define SHADOW_SAMPLER(texID, samplerID) sampler2DShadow(globalShadows[texID], samplers[samplerID])
#define SAMPLE_TEXTURE(texID, samplerID, uv) texture(TEXTURE_SAMPLER(texID, samplerID), uv)
#define SAMPLE_ARRAY_TEXTURE(texID, samplerID, uvLayer) texture(TEXTURE_ARRAY_SAMPLER(texID, samplerID), uvLayer)
#define GATHER_TEXTURE(texID, samplerID, uv, comp) textureGather(TEXTURE_SAMPLER(texID, samplerID), uv, comp)
Including before and after change screenshots
Attachments
Upvote
1