Skip to content

Instantly share code, notes, and snippets.

View CoderJackLiu's full-sized avatar
🐒

liuqi CoderJackLiu

🐒
View GitHub Profile
@CoderJackLiu
CoderJackLiu / greenscreen.cginc
Created April 21, 2021 12:51 — forked from DarkMio/greenscreen.cginc
Basic Chroma Keying HLSL Shader
float _Tolerance;
float _Threshold;
// Color Space Conversions can be found here:
// http://www.poynton.com/PDFs/coloureq.pdf
// http://dougkerr.net/Pumpkin/articles/CIE_XYZ.pdf
// cn -> color normalization
float cnRGB2XYZ(float val) {
if(val > 0.04045) {
return pow((val + 0.055) / 1.055, 2.4);
}