It seems to me that there is a difference in color grading (or some other color property) between openGL and Vulkan. Attached the same image rendered with openGL (left) and Vulkan (right). This is only a small portion of the screen that, in general, looks quite more desaturated with Vulkan…
Same platform: macOS,
No render target, it is a 3D model with a simple custom shader using a light.
The same desaturation appears however also with sprites with a simpler (custom) shader with vertex color.
Maybe it’s the precision modifier? Try doing highp for the color attribute.
I’ve once faced similar issues using a custom engine, the issue was solved by adding v_color.a *= (255.0 / 254.0); to the vertex shader, though I think that’s not the solution here.
I’m getting the slightly muted colours on HTML5 on macOS.
Is it relevant to the issue above? If so I can add the details below to the Github issue.
model_unlit.fp:
varying highp vec2 var_texcoord0; // Texture coordinates from vertex shader
uniform highp sampler2D tex0; // The texture sampler
void main() {
// Sample the texture using the texture coordinates
vec4 color = texture2D(tex0, var_texcoord0);
// Output the color without modifying transparency
gl_FragColor = color;
}
model_unlit.vp:
attribute highp vec4 position; // Position of the vertex
attribute highp vec2 texcoord0; // Texture coordinates
uniform highp mat4 mtx_view; // View matrix
uniform highp mat4 mtx_proj; // Projection matrix
varying highp vec2 var_texcoord0; // Passing texture coordinates to the fragment shader
void main() {
// Pass texture coordinates to the fragment shader
var_texcoord0 = texcoord0;
// Transform vertex position to clip space (for rendering on screen)
gl_Position = mtx_proj * mtx_view * position;
}
Thanks for this. Perhaps you could try if the buildin sprite shader has the issue also on html5. The repro I prepared on github shows the muted colours on macOS with the builtin sprite shader.
I was wondering if monitor calibration was causing it initially¹. However, after testing the actual colour from a screenshot, it’s clear that it’s a different hex (so would show a difference on all screens, regardless of their individual calibration).
This is why I included the hex; FF0066 for the original bitmap, and EB3468 after exported to HTML5.
¹ This was the bane of my life when starting out in web design in the late 90s, because there were no clear standards back in those days. What looked blue on one screen could look green on another.
Are you saying that a different monitor results in a DIFFERENT COLOUR HEX? This boggles my mind. The output device now has something to say about the content it displays?!