Commit ccfe6a17 authored by Chuck Walbourn's avatar Chuck Walbourn
Browse files

Refreshed samples

parent a9aaf82d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ namespace DX
    // ST.2084 to linear, resulting in a linear normalized value
    inline float ST2084ToLinear(float ST2084)
    {
        float normalizedLinear = pow(__max(pow(abs(ST2084), 1.0f / 78.84375f) - 0.8359375f, 0.0f) / (18.8515625f - 18.6875f * pow(abs(ST2084), 1.0f / 78.84375f)), 1.0f / 0.1593017578f);
        float normalizedLinear = pow(std::max(pow(abs(ST2084), 1.0f / 78.84375f) - 0.8359375f, 0.0f) / (18.8515625f - 18.6875f * pow(abs(ST2084), 1.0f / 78.84375f)), 1.0f / 0.1593017578f);
        return normalizedLinear;
    }

+12 −4
Original line number Diff line number Diff line
@@ -26,12 +26,20 @@ static const float3x3 from709to2020 =
    { 0.0163916f, 0.0880132f, 0.8955950f }
};

// Color rotation matrix to rotate Rec.2020 color primaries into Rec.709
static const float3x3 from2020to709 =
{
    { 1.6604910f, -0.5876411f, -0.0728499f },
    { -0.1245505f, 1.1328999f, -0.0083494f },
    { -0.0181508f, -0.1005789f, 1.1187297f }
};

// Color rotation matrix to rotate DCI-P3 color primaries into Rec.2020
static const float3x3 fromP3to2020 =
{
    { 0.753845, 0.198593, 0.047562 },
    { 0.0457456, 0.941777, 0.0124772 },
    { -0.00121055, 0.0176041, 0.983607 }
    { 0.753845f, 0.198593f, 0.047562f },
    { 0.0457456f, 0.941777f, 0.0124772f },
    { -0.00121055f, 0.0176041f, 0.983607f }
};

// Rotation matrix describing a custom color space which is bigger than Rec.709, but a little smaller than P3
@@ -68,7 +76,7 @@ float3 LinearToST2084(float3 normalizedLinearValue)

float3 ST2084ToLinear(float3 ST2084)
{
    float3 normalizedLinear = pow(max(pow(abs(ST2084), 1.0f / 78.84375f) - 0.8359375f, 0.0f) / (18.8515625f - 18.6875f * pow(abs(ST2084), 1.0f / 78.84375f)), 1.0f / 0.1593017578f);
    float3 normalizedLinear = pow(abs(max(pow(abs(ST2084), 1.0f / 78.84375f) - 0.8359375f, 0.0f) / (18.8515625f - 18.6875f * pow(abs(ST2084), 1.0f / 78.84375f))), 1.0f / 0.1593017578f);
    return normalizedLinear;
}

+3 −1
Original line number Diff line number Diff line
@@ -24,10 +24,12 @@ float4 PSTextured(PSInputPixelLightingTxTangent pin) : SV_Target0

    // Get albedo, then roughness, metallic and ambient occlusion
    float4 albedo = PBR_AlbedoTexture.Sample(PBR_SurfaceSampler, pin.TexCoord);

	// glTF2 defines metalness as B channel, roughness as G channel, and occlusion as R channel
    float3 RMA = PBR_RMATexture.Sample(PBR_SurfaceSampler, pin.TexCoord);
  
    // Shade surface
    float3 output = PBR_LightSurface(V, N, 3, PBR_LightColor, PBR_LightDirection, albedo.rgb, RMA.x, RMA.y, RMA.z);
    float3 output = PBR_LightSurface(V, N, 3, PBR_LightColor, PBR_LightDirection, albedo.rgb, RMA.g, RMA.b, RMA.r);

    return float4(output, albedo.w);
}
+3 −1
Original line number Diff line number Diff line
@@ -33,10 +33,12 @@ PSOut_Velocity PSTexturedVelocity(VSOut_Velocity pin)

    // Get albedo, then roughness, metallic and ambient occlusion
    float4 albedo = PBR_AlbedoTexture.Sample(PBR_SurfaceSampler, pin.current.TexCoord);

	// glTF2 defines metalness as B channel, roughness as G channel, and occlusion as R channel
    float3 RMA = PBR_RMATexture.Sample(PBR_SurfaceSampler, pin.current.TexCoord);
  
    // Shade surface
    float3 color = PBR_LightSurface(V, N, 3, PBR_LightColor, PBR_LightDirection, albedo.rgb, RMA.x, RMA.y, RMA.z);
    float3 color = PBR_LightSurface(V, N, 3, PBR_LightColor, PBR_LightDirection, albedo.rgb, RMA.g, RMA.b, RMA.r);

    output.color = float4(color, albedo.w);
    
+139 KiB

File added.

Preview suppressed by a .gitattributes entry or the file's encoding is unsupported.

Loading