fix(globe): Navara overlay colours are sRGB

Review of Tasks 4-5: the overlay pass encodes linear to sRGB, and the
instance and line colours went in as if linear: grey 0.5 drew 187 (Cesium
128) and [1, 0.6, 0.2] drew 255/203/124 (Cesium 255/153/52). The sprite,
point and line shaders now decode them (sRGBTransferEOTF), as the sRGB
atlas texture already was.

A contract check draws mid-tone sprites, points and lines (grey 0.5 and
[1, 0.6, 0.2]) and reads their centres: within 3 per channel on every
engine. Navara 79/79.
This commit is contained in:
German Khokhlov committed 2026-10-16 20:51:36 +04:00
1 parent 645f042450
commit 68ff4e1c25
3 files changed
+105 -3

No files matched your search

+2 -1
View File
@@ -90,7 +90,8 @@ float gevTactical() {
const FRAGMENT_COLOR = /* glsl */ `
#include <color_fragment>
if (gevOverlayHidden()) discard;
diffuseColor = uGevColor;
// sRGB colours (as Cesium takes them) into the linear output.
diffuseColor = sRGBTransferEOTF(uGevColor);
diffuseColor.a *= uGevAlphaScale;
if (uGevDash > 1.5) {
diffuseColor.a *= gevTactical();
+5 -2
View File
@@ -89,6 +89,9 @@ varying float vGevOutline;
${OVERLAY_DEPTH_FRAGMENT}
`;
// Instance colours are sRGB (as Cesium takes them) and the overlay output
// encodes linear to sRGB, so they are decoded first (the atlas is an sRGB
// texture, decoded by the sampler): grey 0.5 draws 128, not 187.
const fragmentColor = (point) =>
point
? /* glsl */ `
@@ -96,13 +99,13 @@ const fragmentColor = (point) =>
if (gevOverlayHidden()) discard;
float gevRadius = length(vGevLocal) * 2.0;
if (gevRadius > 1.0) discard;
diffuseColor *= vGevColor;
diffuseColor *= sRGBTransferEOTF(vGevColor);
if (gevRadius > 1.0 - vGevOutline) diffuseColor.rgb = vec3(0.0);
`
: /* glsl */ `
#include <color_fragment>
if (gevOverlayHidden()) discard;
diffuseColor *= vGevColor;
diffuseColor *= sRGBTransferEOTF(vGevColor);
`;
// Overlay uniforms of a mesh drawn outside an overlay (tests): no depth.