Skip to content

Commit 6c90583

Browse files
committed
bugfix(w3d): Draw missing textures untextured where the pixels are read
A texture that fails to load is a 128x128 fill of half-transparent magenta. Binding the white fallback instead only covers the draw path, and the terrain does not take it: it composites its tile textures by reading their contents, so the magenta lands in the terrain atlas itself. What renders after that is an ordinary, valid texture that happens to contain magenta, which no missing-texture check at bind time can catch - the reason the earlier fix left the terrain pink while models came out clean. Retail data references terrain tiles it never shipped - trstrtholecvr.tga - so on the web that washed magenta across the ground wherever those tiles were used. It is the "pink" this port was reported with, and it is absent from the branch the port came from only because that branch never built the placeholder at all. Hand out white on the web at the source instead, which covers the composite and the draw path alike. Diagnosis does not suffer: every failure still writes "Missing texture <reason>: <file>" to stderr, which on the web shows up in the browser console - that is how the offending asset was identified. Other platforms keep the magenta.
1 parent 8afc4e5 commit 6c90583

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Core/Libraries/Source/WWVegas/WW3D2/missingtexture.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,21 @@ void MissingTexture::_Deinit()
8585

8686
void MissingTexture::Build_CPU_Texture_Mips(std::vector<TextureBaseClass::TextureMipSnapshot> &mips)
8787
{
88+
// TheSuperHackers @bugfix githubawn 30/07/2026 These pixels are not only what a
89+
// missing texture is drawn with - they are also what anything that reads a texture's
90+
// contents gets back, and the terrain composites its tile textures that way. Retail
91+
// data references terrain tiles it never shipped (trstrtholecvr.tga), so on the web
92+
// the magenta was blended into the terrain atlas itself and no longer looked like a
93+
// bound placeholder: it survived the missing-texture check at bind time, which is why
94+
// selecting the white fallback there did not clear it. Hand out white on the web so
95+
// the composite stays untextured instead. The failure is still reported - every one
96+
// writes "Missing texture <reason>: <file>" to stderr, which lands in the browser
97+
// console. Other platforms keep the magenta.
98+
#if defined(__EMSCRIPTEN__)
99+
constexpr unsigned kMissingPixel = 0xFFFFFFFF;
100+
#else
88101
constexpr unsigned kMissingPixel = 0x7FFF00FF;
102+
#endif
89103
unsigned width = missing_image_width;
90104
unsigned height = missing_image_height;
91105
mips.clear();

0 commit comments

Comments
 (0)