ericwa/ericw-tools

Textures issues with the new compiler

Closed this issue · 11 comments

Trying out the new compiler (2.0.0-alpha5), and I'm getting some textures that are swapped or become broken on compile.
Might be a problem with some specific textures.
If I switch back to 0.18.2 everything works as usual.

Here's what I have in editor:
image
And in game it's swapped to another random texture:
image

I tried to remove everything from my map but that brush to see what would happen, and it ends up having no texture at all:
image

Here's the test map (rename it ofc):
newcompiler_textureissue.txt
The wad is available here:
https://www.slipseer.com/index.php?resources/makkon-textures.28/version/462/download&file=3827

@bstordeur I'm just getting set up to investigate this - when I open the testmap in TB I'm getting all textures missing.

Which wad is ground_brwn01 in? I've got the makkon wads listed in worldspawn and there aren't any ground_ textures in them. I don't have bal_misc.wad, maybe it's in there?

image

image

I guess Makkon changed his wads a while back, they are split up differently than before, so the texture is no longer in the nature one. You can get it here instead https://www.slipseer.com/index.php?resources/makkon-textures.28/version/462/download&file=3828 it's makkon_nature_legacy.wad.

Thanks, I got makkon_nature_legacy.wad downloaded, and edited the .map in a text editor to refer to ..\Wads\makkon_nature_legacy.wad instead of ..\Wads\makkon_nature.wad.

Now it loads in TB (minus the sky).

I compiled it with:

..\..\ericw-tools-2.0.0-alpha5-win64\bin\qbsp.exe .\newcompiler_textureissue.map
..\..\ericw-tools-2.0.0-alpha5-win64\bin\vis.exe .\newcompiler_textureissue.map
..\..\ericw-tools-2.0.0-alpha5-win64\bin\light.exe .\newcompiler_textureissue.map

and copied the resulting .bsp to my quake/id1/maps folder; it appears as expected:

image

Not sure what's going on.. maybe bal_misc.wad is triggering a bug in alpha5?

Hmm, I don't understand, I've removed all other wads, only using 2 textures in the map now, and that one still does not work, it shows up all busted. Looks the same in vkQuake and IW.
image

I'll try to recheck everything tomorrow.

The output log from qbsp, and the resulting .bsp file itself, might have some clues.

Those black stripes, and the stretched textures, in your in-game shot make me think the .bsp is corrupted, maybe qbsp didn't find the grass texture in your case.

@bstordeur sorry to bug you, I wanted to see if I can fix this. Could you send over the corrupt .bsp + compile logs + maybe a screenshot of how the compile was launched (TB compile UI?) whenever you have a chance?

I'm kind of stumped but hopefully with the actual broken .bsp and logs I can reverse engineer what's going on.

Yeah sorry @ericwa I switched to an other map that has no issues and been busy with work.
Gonna reopen this thing and give you a complete repro-case in a few hours.

Here, map, bsp, log and wad.
texturebug.zip

You'll see that if you open the .bsp in a texture editor one of the textures is corrupted.
image

Thanks!

Getting some ideas..

bspinfo.exe json dump of the .bsp:

    "textures": [
        null,
        {
            "height": 1024,
            "name": "ground_brwn01",
            "width": 1024
        },
        {
            "height": 512,
            "mips": [
                "data:image/png;base64,<data omitted for pasting here>"
            ],
            "name": "cliff_blck_20",
            "width": 512
        }
    ],

So apparently inside the bsp, the ground_brwn01 is missing its texture data, which is illegal (qbsp shouldn't have ever written that). That would explain why it looks like a squished version of cliff_blck_20, I guess the readers are reading forward into the next texture's image data.

Cool, I found a way to repro it:

C:\Users\Eric\Downloads\quake\modding\Maps\newcompiler_textureissue.map
C:\Users\Eric\Downloads\quake\modding\Maps\ground_brwn01.tga <-- new file I added
C:\Users\Eric\Downloads\quake\modding\Wads\texturebug.wad

then open a terminal in C:\Users\Eric\Downloads\quake\modding\Maps\ and run qbsp.exe -v newcompiler_textureissue.map.

This is a case of the Q2 support in qbsp interacting in an unexpected way... qbsp is finding the .tga and treating it with higher priority than the .wad, but there's presently no code path for converting the .tga to a .wad style texture so it writes an invalid texture to the .bsp, with a name, size, but no data.

I think for a fix we want to ignore everything but .wad textures in Q1 mode.

Oh damn, I do indeed have that texture as a .jpg in my maps folder, for years ago when I did some terrain work in Maya and wanted to see what I was doing! Wouldn't ever have thought to check that.