add the old "lighting" thingy

This commit is contained in:
griffi-gh 2024-05-13 23:56:31 +02:00
parent db05b0902d
commit e7d81ce7cc

View file

@ -39,10 +39,20 @@ var s_diffuse: sampler;
@fragment @fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> { fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
let color: vec4<f32> = textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index); // not actual lighting; makes it easier to distinguish unlit faces
let light: f32 =
abs(in.normal.x) + .85 *
abs(in.normal.y) + .65 *
abs(in.normal.z);
let color: vec4<f32> =
textureSample(t_diffuse, s_diffuse, in.uv, in.tex_index)
* vec4<f32>(light, light, light, 1.0);
if (color.a < 0.5) { if (color.a < 0.5) {
discard; discard;
} }
return color; return color;
} }