Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion MetalSplatter/Resources/Shaders.metal
Original file line numberDiff line numberDiff line change
Expand Up@@ -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] = {
Expand DownExpand Up@@ -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;
}

Expand Down