-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdifference-key.pbk
More file actions
50 lines (43 loc) · 976 Bytes
/
Copy pathdifference-key.pbk
File metadata and controls
50 lines (43 loc) · 976 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<languageVersion : 1.0;>
kernel DifferenceKey
< namespace : "com.quasimondo";
vendor : "Quasimondo";
version : 1;
description : "A simple difference key for chroma keying";
>
{
input image4 src;
output pixel4 dst;
parameter float3 keyColor;
parameter float tolerance
<
minValue: 0.0;
maxValue: 3.0;
defaultValue: 0.02;
>;
parameter float ramp
<
minValue: 0.0;
maxValue: 1.0;
defaultValue: 0.005;
>;
parameter float gamma
<
minValue: 0.0;
maxValue: 10.0;
defaultValue: 1.00;
>;
void
evaluatePixel()
{
dst = sampleNearest(src,outCoord());
float diff = length( dst.rgb - keyColor );
if ( diff < tolerance )
{
dst.a = 0.0;
} else if ( diff < tolerance + ramp )
{
dst.a = pow( (diff - tolerance) / ramp, gamma );
}
}
}