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);
if ((color.a < 0.1)) {
discard_fragment();
}
float bright = select(0.0, 1.0, (color.r > 0.5));
__luma_output._value = float4((color.rgb * bright), color.a);
return __luma_output;
}