diff --git a/MetalSplatter/Resources/Shaders.metal b/MetalSplatter/Resources/Shaders.metal index 8bfd8ab7..80b2fbc6 100644 --- a/MetalSplatter/Resources/Shaders.metal +++ b/MetalSplatter/Resources/Shaders.metal @@ -49,6 +49,10 @@ typedef struct float4 color; } ColorInOut; +float4 decodeGamma(float4 v) { + return float4(pow(v.rgb, float3(2.2)), v.a); +} + float3x3 quaternionToMatrix(float4 quaternion) { float3x3 rotationMatrix; rotationMatrix[0] = { @@ -213,7 +217,8 @@ vertex ColorInOut splatVertexShader(uint vertexID [[vertex_id]], out.position = float4(screenVertex.x, screenVertex.y, 0, 1); out.textureCoordinates = textureCoordinates; - out.color = splat.color; + // the color here is in gamma space, so bring it to linear + out.color = decodeGamma(splat.color); return out; }