Files
o3de/Gems/Atom/Feature/Common/Assets/Shaders/PostProcessing/SMAAUtils.azsli
T
2021-03-08 14:30:57 -08:00

29 lines
1.1 KiB
Plaintext

/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#define PROVISIONAL_TONEMAP_GAMMA 2.4
float4 ApplyProvisionalTonemap(float4 color)
{
// Provisional tone mapping will be applied using Reinhard, then applying gamma to handle the color in perceptual color space.
float3 toneMappedColor = color.xyz / (1.0 + color.xyz);
return float4(pow(toneMappedColor, 1.0 / PROVISIONAL_TONEMAP_GAMMA), color.w);
}
float4 ApplyInverseProvisionalTonemap(float4 color)
{
// This is inverse function of provisional tone mapping.
float3 linearValue = pow(color.xyz, PROVISIONAL_TONEMAP_GAMMA);
return float4(linearValue / (1.0 - linearValue), color.w);
}