# Metal is rendering textures darker than they should be? [duplicate]

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. Why are there so many bugs within the libraries?

• Please don't post duplicate questions. If your previous question isn't getting the traction you want, use the edit features to add more detail — like code for a Minimal Complete Verifiable Example, or troubleshooting steps you've tried. If you've accidentally created a second account, you can merge your accounts to regain access to edit your original question. – DMGregory May 12 '20 at 7:07