Skip to content

Commit

Permalink
Update cColor.fxh
Browse files Browse the repository at this point in the history
  • Loading branch information
papadanku committed Jul 30, 2024
1 parent 1d40154 commit 67bc585
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions shaders/shared/cColor.fxh
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,6 @@
return ((Color.br - Y) * float2(0.564, 0.713)) + 0.5;
}

/*
RGB to saturation value.
---
Golland, Polina, and Alfred M. Bruckstein. "Motion from color."
Computer Vision and Image Understanding 68, no. 3 (1997): 346-362.
---
http://www.cs.technion.ac.il/users/wwwb/cgi-bin/tr-get.cgi/1995/CIS/CIS9513.pdf
*/

float CColor_SaturateRGB(float3 Color)
{
// Calculate min and max RGB
float MinColor = min(min(Color.r, Color.g), Color.b);
float MaxColor = max(max(Color.r, Color.g), Color.b);

// Calculate normalized RGB
float SatRGB = (MaxColor - MinColor) / MaxColor;
SatRGB = (MaxColor == 0.0) ? 0.0 : SatRGB;

return SatRGB;
}

/*
Color-space conversion
---
Expand Down

0 comments on commit 67bc585

Please sign in to comment.