Skip to content

Commit

Permalink
Update normalization minima
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Feb 7, 2022
1 parent 10cda17 commit 19d3a69
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
11 changes: 6 additions & 5 deletions shaders/cColorNormalization.fx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position,

/*
Sources
Angle-Retaining Chromaticity
Angle-Retaining Chromaticity
Copyright 2020 Marco Buzzelli, Simone Bianco, Raimondo Schettini.
If you use this code in your research, please cite:
@article{buzzelli2020arc,
Expand All @@ -91,8 +91,9 @@ void PostProcessVS(in uint ID : SV_VertexID, out float4 Position : SV_Position,

void NormalizationPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float3 OutputColor0 : SV_Target0)
{
OutputColor0 = 0.0;
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, 1e-7);
OutputColor0 = 0.0;
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, Minima);
switch(_Select)
{
case 0:
Expand All @@ -113,8 +114,8 @@ void NormalizationPS(in float4 Position : SV_Position, in float2 TexCoord : TEXC
break;
case 4:
// Jamie Wong's RG Chromaticity
OutputColor0 = Color / dot(Color, 1.0);
OutputColor0.rg = saturate(OutputColor0.rg / max(max(OutputColor0.r, OutputColor0.g), OutputColor0.b));
float3 NormalizedRGB = Color / dot(Color, 1.0);
OutputColor0.rg = saturate(NormalizedRGB.rg / max(max(NormalizedRGB.r, NormalizedRGB.g), NormalizedRGB.b));
break;
case 5:
// Jamie Wong's RGB Chromaticity
Expand Down
3 changes: 2 additions & 1 deletion shaders/cHornSchunck.fx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ namespace HornSchunck

void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0)
{
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, 1e-7);
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, Minima);
OutputColor0 = saturate(Color.xy / dot(Color, 1.0));
}

Expand Down
3 changes: 2 additions & 1 deletion shaders/cInterpolation.fx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,8 @@ namespace Interpolation

void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0)
{
float3 Color = max(tex2D(_SampleFrame0, TexCoord).rgb, 1e-7);
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleFrame0, TexCoord).rgb, Minima);
OutputColor0 = saturate(Color.xy / dot(Color, 1.0));
}

Expand Down
3 changes: 2 additions & 1 deletion shaders/cMotionBlur.fx
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ namespace MotionBlur

void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0)
{
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, 1e-7);
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, Minima);
OutputColor0 = saturate(Color.xy / dot(Color, 1.0));
}

Expand Down
3 changes: 2 additions & 1 deletion shaders/cOpticalFlow.fx
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ namespace OpticalFlow

void NormalizePS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0)
{
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, 1e-7);
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, Minima);
OutputColor0 = saturate(Color.xy / dot(Color, 1.0));
}

Expand Down
3 changes: 2 additions & 1 deletion shaders/kDatamosh.fx
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ namespace DataMosh

void ConvertPS(in float4 Position : SV_Position, in float2 TexCoord : TEXCOORD0, out float2 OutputColor0 : SV_Target0)
{
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, 1e-7);
const float Minima = ldexp(1.0, -8.0);
float3 Color = max(tex2D(_SampleColor, TexCoord).rgb, Minima);
OutputColor0 = saturate(Color.xy / dot(Color, 1.0));
}

Expand Down

0 comments on commit 19d3a69

Please sign in to comment.