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.