Add small scale for color grading LUT
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -281,8 +281,11 @@ float4 CombineLUTs(float2 uv, uint layerIndex)
|
||||
#endif
|
||||
|
||||
// Move from encoded LUT color space to linear color
|
||||
//float3 linearColor = encodedColor.rgb; // Default
|
||||
#if COLOR_GRADING_LUT_LOG
|
||||
float3 linearColor = LogToLinear(encodedColor.rgb) - LogToLinear(0); // Log
|
||||
#else
|
||||
float3 linearColor = encodedColor.rgb; // Default
|
||||
#endif
|
||||
|
||||
// Apply white balance
|
||||
linearColor = WhiteBalance(linearColor);
|
||||
@@ -300,7 +303,7 @@ float4 CombineLUTs(float2 uv, uint layerIndex)
|
||||
color = lerp(color, lutColor, LutWeight);
|
||||
}
|
||||
|
||||
return float4(color, 1);
|
||||
return float4(color / COLOR_GRADING_LUT_SCALE, 1);
|
||||
}
|
||||
|
||||
// Vertex shader that writes to a range of slices of a volume texture
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
|
||||
#include "./Flax/Math.hlsl"
|
||||
|
||||
// Shared configs for Color Grading LUT
|
||||
#define COLOR_GRADING_LUT_LOG 1
|
||||
#define COLOR_GRADING_LUT_SCALE 1.04f
|
||||
|
||||
// Fast reversible tonemapper
|
||||
// http://gpuopen.com/optimized-reversible-tonemapper-for-resolve/
|
||||
float3 FastTonemap(float3 c)
|
||||
|
||||
@@ -115,18 +115,20 @@ static const float LUTSize = 32;
|
||||
half3 ColorLookupTable(half3 linearColor)
|
||||
{
|
||||
// Move from linear color to encoded LUT color space
|
||||
//float3 encodedColor = linearColor; // Default
|
||||
#if COLOR_GRADING_LUT_LOG
|
||||
float3 encodedColor = LinearToLog(linearColor + LogToLinear(0)); // Log
|
||||
#else
|
||||
float3 encodedColor = linearColor; // Default
|
||||
#endif
|
||||
|
||||
float3 uvw = encodedColor * ((LUTSize - 1) / LUTSize) + (0.5f / LUTSize);
|
||||
|
||||
#if USE_VOLUME_LUT
|
||||
half3 color = ColorGradingLUT.Sample(SamplerLinearClamp, uvw).rgb;
|
||||
#else
|
||||
half3 color = SampleUnwrappedTexture3D(ColorGradingLUT, SamplerLinearClamp, uvw, LUTSize).rgb;
|
||||
#endif
|
||||
|
||||
return color;
|
||||
return color * COLOR_GRADING_LUT_SCALE;
|
||||
}
|
||||
|
||||
// A random texture generator
|
||||
|
||||
Reference in New Issue
Block a user