bevy_webgl2 icon indicating copy to clipboard operation
bevy_webgl2 copied to clipboard

Colors rendered differently compared to bevy default renderer

Open rsk700 opened this issue 2 years ago • 0 comments

I've tried to render simple mesh with vertex colors:

mesh.set_attribute(Mesh::ATTRIBUTE_COLOR, vec![[0.7, 0.2, 0.2]; buffers.vertices.len()]);

and looks like webgl2 in this case interprets color as sRGB, and bevy as linearRGB using same code in both (left is web): same

but if in native version I convert color from sRGB to linear first, then result color will be the same

let color = Color::rgb(0.7, 0.2, 0.2).as_linear_rgba_f32();
mesh.set_attribute(
    Mesh::ATTRIBUTE_COLOR,
    vec![[color[0], color[1], color[2]]; buffers.vertices.len()],
);

to_linear

rsk700 avatar Oct 07 '21 15:10 rsk700