Skip to content

Instantly share code, notes, and snippets.

View CoderJackLiu's full-sized avatar
🐒

liuqi CoderJackLiu

🐒
View GitHub Profile
@DarkMio
DarkMio / greenscreen.cginc
Created October 16, 2017 09:59
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);
}