This commit is contained in:
2026-03-09 09:58:41 -07:00
parent 60fa8670ff
commit 8029a15238

View File

@@ -1,5 +1,5 @@
struct VertexOutput {
@builtin(position) position: vec4<f32>,
@builtin(position) position: vec4<f32>,
}
@group(0)
@@ -8,21 +8,21 @@ var texture: texture_2d<f32>;
@fragment
fn fs_main_y(input: VertexOutput) -> @location(0) f32 {
let conversion_weights = vec3<f32>(0.2126, 0.7152, 0.0722);
let color = textureSample(texture, model_sampler, vertex.texture);
let conversion_weights = vec3<f32>(0.2126, 0.7152, 0.0722);
let color = textureSample(texture, model_sampler, vertex.texture);
return clamp(dot(color, conversion_weights), 0.0, 1.0);
return clamp(dot(color, conversion_weights), 0.0, 1.0);
}
@fragment
fn fs_main_uv(input: VertexOutput) -> @location(0) vec2<f32> {
let conversion_weights = mat3x2<f32>(
-0.1146, 0.5,
-0.3854, -0.4542,
0.5, -0.0458,
);
let conversion_bias = vec2<f32>(0.5, 0.5);
let color = textureSample(texture, model_sampler, vertex.texture);
let conversion_weights = mat3x2<f32>(
-0.1146, 0.5,
-0.3854, -0.4542,
0.5, -0.0458,
);
let conversion_bias = vec2<f32>(0.5, 0.5);
let color = textureSample(texture, model_sampler, vertex.texture);
return clamp(conversion_weights * color + conversion_bias, vec2(0.0, 0.0), vec2(1.0, 1.0));
return clamp(conversion_weights * color + conversion_bias, vec2(0.0, 0.0), vec2(1.0, 1.0));
}