From d5f08c8a100a24775daf8219bd4d9c277bfdd070 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 4 Nov 2026 01:07:38 +0100 Subject: Skybox image: swap red/blue in the uploaded texture The procedural texture reaches the sky sampler with the red and blue channels exchanged (blue sky rendered orange/yellow), while the game's own textures are correct. Swap R/B in the decoded buffer so the sampled colours match the PNG. --- src/world.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/world.cpp b/src/world.cpp index 092df77..38d302f 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -610,6 +610,15 @@ bool load_png_rgba(const char *path, std::vector &pixels, } } + // The material system's procedural upload reaches the sampler with red and + // blue exchanged (the sky shader sees the blue background as orange). Swap + // them here so the sampled colours match the PNG. + for (size_t i = 0; i + 3 < pixels.size(); i += 4) { + unsigned char t = pixels[i]; + pixels[i] = pixels[i + 2]; + pixels[i + 2] = t; + } + out_w = (int)w; out_h = (int)h; return true; -- cgit v1.2.3