# Why is Metal is rendering textures SLIGHTLY darker than they should be?

I already checked this question. Using [MTKTextureLoader.Option.SRGB : false] in texture loader options doesn't work. All that happens is when I do [MTKTextureLoader.Option.SRGB : true], it's a lot darker instead of slightly darker. There must be something else. Here is an example of this unwanted behavior. As you can see I am using the mouse to hold the original packed ice texture over the rendered one. It's considerably lighter, even with [MTKTextureLoader.Option.SRGB : false].

Here is my fragment function:

fragment half4 TextureFragment(VertexOut VertexIn [[stage_in]], texture2d<float> Texture [[texture(0)]]) {
constexpr sampler ColorSampler(mip_filter::nearest, mag_filter::nearest, min_filter::nearest);
float4 Color = Texture.sample(ColorSampler, VertexIn.TexCoord.xy / VertexIn.TexCoord.z);
return half4(Color.r, Color.g, Color.b, 1);
}


How can I fix the problem? How can I render the actual texture instead of a darker version?

Note: I must fix the problem, not work around it. A workaround would be like return half4(Color.r, Color.g, Color.b, 1); from the fragment shader. I must fix the problem from the root.

• If you draw the background white instead of black, do the colors look lighter? – Panda Pajama May 10 at 16:09
• @PandaPajama I tried a white background, and the texture is still darker – user139507 May 12 at 19:07