ata4 / bspsrc

A Source engine map decompiler
Other
657 stars 86 forks source link

Decompiling Half-life 2 OG XBOX maps results in incorrect textures on some surfaces. #160

Open LittlePlanetCD opened 1 year ago

LittlePlanetCD commented 1 year ago

Okay, so, this is a lot to explain.

There's something going on with the decompiler, where decompiling XBOX HL2 maps makes different textures appear on parts of brushes.

Most notably, you can decompile d1_transtation_05 from the XBOX port and you'd notice that the area where breen is has a LOT of the faces in the area covered by metaltruss textures, for no reason.

It's a very strange issue... I don't know why it happens. These textures cause vbsp to report leaks, so is it possible for this to get fixed, somehow?

rihi commented 2 months ago

I've had a look at the map and it seems like XBOX HL2 does some things different with how texture infos are compressed. Sadly, in this case, I'm not sure if there's a way to identify these faces which should be nodraw. So for now don't expect any fix soon.

For people interested in the details and for future reference: Normally faces touching the void will get NODRAW and NOLIGHT surface flags applied. Later, vbsp compresses the texture info array by removing unnecessary textures. Those texture are, I believe, the ones marked with NODRAW. It will select the first texture which has NODRAW and replace every other occurrence of another texture which also uses NODRAW with this one. This effectively reduces the size of the texture info array, as less unique texture need to be stored. This is also the reason, why we do tooltexture fixing, as tooltextures also have NODRAW and get optimized subsequently. However, because surface flags and brushflags remain untouched, we can sort of recover (guess) the original texture. In the case of XBOX HL2 this however doesn't seem to be the case for void touching surfaces? In d1_trainstation_05, void touching surfaces only had the SOLID brush flag an no surface flag, allowing for no recovery of the texture.