Fixed color display to fit sRGB
This commit is contained in:
parent
99d5b76f02
commit
e88a5d171a
@ -18,7 +18,16 @@ fn vs_main(
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn srgb_to_linear(c: f32) -> f32 {
|
||||||
|
return pow((c + 0.055) / 1.055, 2.4);
|
||||||
|
}
|
||||||
|
|
||||||
@fragment
|
@fragment
|
||||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
return vec4<f32>(in.color, 1.0);
|
let linear_color = vec3<f32>(
|
||||||
|
srgb_to_linear(in.color.r),
|
||||||
|
srgb_to_linear(in.color.g),
|
||||||
|
srgb_to_linear(in.color.b),
|
||||||
|
);
|
||||||
|
return vec4<f32>(linear_color, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user