1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
struct _shade_Input {
@location(0) uv: vec2<f32>,
@location(1) normal: vec3<f32>,
}
struct _shade_Output {
@location(0) _value: vec4<f32>,
}
@group(0) @binding(0) var material_tex_tex: texture_2d<f32>;
@group(0) @binding(1) var material_tex_samp: sampler;
@fragment
fn shade(input: _shade_Input) -> _shade_Output {
var __luma_output: _shade_Output;
let albedo = textureSample(material_tex_tex, material_tex_samp, input.uv);
let n = normalize(input.normal);
let light_dir = normalize(vec3<f32>(1.0, 1.0, 0.5));
let light = max(dot(n, light_dir), 0.0);
__luma_output._value = vec4<f32>((albedo.rgb * light), albedo.a);
return __luma_output;
}