sampler s0; float4 main(float2 tex : TEXCOORD) : COLOR { // Fetch the original pixel float4 color = tex2D(s0, tex); // Limited to Full float3 expandedColor = (color.rgb - 0.0627) * 1.1644; // BT.2020 to REC.709 transformation matrix float3 transformedColor = float3( expandedColor.r * 1.6605 + expandedColor.g * -0.5876 + expandedColor.b * -0.0728, expandedColor.r * -0.1246 + expandedColor.g * 1.1329 + expandedColor.b * -0.0083, expandedColor.r * 0.0177 + expandedColor.g * -0.1006 + expandedColor.b * 1.0829 ); // Return the transformed color return float4(transformedColor, color.a); }