Darken (float4 a, float4 b) { return float4(min(a.rgb, b.rgb), 1); } |
Multiply (float4 a, float4 b) { return (a * b); } |
ColorBurn (float4 a, float4 b) { return (1-(1-a)/b); } |
LinearBurn (float4 a, float4 b) { return (a+b-1); } |
Lighten (float4 a, float4 b) |
ColorDodge (float4 a, float4 b) { return (a/(1-b)); }
LinearDodge (float4 a, float4 b) { return (a+b); }
Overlay (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (a.r > 0.5) { r.r = 1-(1-2*(a.r-0.5))*(1-b.r); }
else { r.r = (2*a.r)*b.r; }
if (a.g > 0.5) { r.g = 1-(1-2*(a.g-0.5))*(1-b.g); }
else { r.g = (2*a.g)*b.g; }
if (a.b > 0.5) { r.b = 1-(1-2*(a.b-0.5))*(1-b.b); }
else { r.b = (2*a.b)*b.b; }
return r;
}
SoftLight (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (b.r > 0.5) { r.r = a.r*(1-(1-a.r)*(1-2*(b.r))); }
else { r.r = 1-(1-a.r)*(1-(a.r*(2*b.r))); }
if (b.g > 0.5) { r.g = a.g*(1-(1-a.g)*(1-2*(b.g))); }
else { r.g = 1-(1-a.g)*(1-(a.g*(2*b.g))); }
if (b.b > 0.5) { r.b = a.b*(1-(1-a.b)*(1-2*(b.b))); }
else { r.b = 1-(1-a.b)*(1-(a.b*(2*b.b))); }
return r;
}
HardLight (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (b.r > 0.5) { r.r = 1-(1-a.r)*(1-2*(b.r)); }
else { r.r = a.r*(2*b.r); }
if (b.g > 0.5) { r.g = 1-(1-a.g)*(1-2*(b.g)); }
else { r.g = a.g*(2*b.g); }
if (b.b > 0.5) { r.b = 1-(1-a.b)*(1-2*(b.b)); }
else { r.b = a.b*(2*b.b); }
return r;
}
VividLight (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (b.r > 0.5) { r.r = 1-(1-a.r)/(2*(b.r-0.5)); }
else { r.r = a.r/(1-2*b.r); }
if (b.g > 0.5) { r.g = 1-(1-a.g)/(2*(b.g-0.5)); }
else { r.g = a.g/(1-2*b.g); }
if (b.b > 0.5) { r.b = 1-(1-a.b)/(2*(b.b-0.5)); }
else { r.b = a.b/(1-2*b.b); }
return r;
}
LinearLight (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (b.r > 0.5) { r.r = a.r+2*(b.r-0.5); }
else { r.r = a.r+2*b.r-1; }
if (b.g > 0.5) { r.g = a.g+2*(b.g-0.5); }
else { r.g = a.g+2*b.g-1; }
if (b.b > 0.5) { r.b = a.b+2*(b.b-0.5); }
else { r.b = a.b+2*b.b-1; }
return r;
}
PinLight (float4 a, float4 b) {float4 r = float4(0,0,0,1);
if (b.r > 0.5) { r.r = max(a.r, 2*(b.r-0.5)); }
else { r.r = min(a.r, 2*b.r); }
if (b.g > 0.5) { r.g = max(a.g, 2*(b.g-0.5)); }
else { r.g = min(a.g, 2*b.g); }
if (b.b > 0.5) { r.b = max(a.b, 2*(b.b-0.5)); }
else { r.b = min(a.b, 2*b.b); }
return r;
}
Difference (float4 a, float4 b) { return (abs(a-b)); }
Exclusion (float4 a, float4 b) { return (0.5-2*(a-0.5)*(b-0.5)); }
'Technical Report > Unity Shader' 카테고리의 다른 글
[번역]Unity Labs: AutoLOD – Experimenting with automatic performance improvements (0) | 2018.01.14 |
---|---|
Unity output value 'vert' is not completely initialized (0) | 2017.09.25 |
Unity fragment self shadow casting (0) | 2017.09.18 |
Unity Shaderlab Shader Model Features (0) | 2017.09.04 |
Unity Fallback 선언에 따른 shader variants 생성자 (0) | 2017.08.03 |