1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <metal_stdlib>
using namespace metal;
struct _fs_main_Input {
float2 uv [[user(locn0)]];
};
struct _fs_main_Output {
float4 _value [[user(locn0)]];
};
fragment _fs_main_Output fs_main(_fs_main_Input input [[stage_in]],
texture2d<float> albedo_tex_tex [[texture(0)]],
sampler albedo_tex_samp [[sampler(0)]]) {
_fs_main_Output __luma_output;
float4 color = albedo_tex_tex.sample(albedo_tex_samp, input.uv);
float dx = dfdx(color.r);
float dy = dfdy(color.r);
float fw = fwidth(color.r);
float edge = step(0.1, fw);
__luma_output._value = float4((color.rgb * (1.0 - edge)), color.a);
return __luma_output;
}