Welcome back to Half-Life: Enriched! If you want you can dive right in with the new alpha build of Office Complex:
Let's talk about TEX, baby!
The two things that stand out in HL:Enriched are the new lighting and the texturing. I've gotten a few questions about the latter, so today's news post is all about that.
Generally Half-Life uses a very low texture resolution of 128 by 128 pixels or even lower: 64x64 and 32x32 are also frequently used. Only in a few rare cases textures go up to 256 pixels. In our time with 4K and even 8K, this seems very primitive but back when Half-Life was developed 128x128 was a very common texture size.
It seems wierd now but the hardware just wasn't able to handle much more. Up to 1999, many 3D videocards could not even display textures with a higher resolution than 256x256, for instance the very popular 3DFX Voodoo 2 (and even the Voodoo 3 after that).
Technically, the Half-Life engine is capable of displaying 512x512 textures (even slightly higher with some tricks) but it comes with quite a lot of drawbacks. First problem is performance: your FPS (frames per second) is determined by the amount of polygons on screen. There are polygons from models (epoly) and polygons from the world geometry (wpoly).
The wpoly is generated by face subdivision. If you place a 128x128 texture (with scale 1.0) on a 128 by 128 unit wall, then you'll generate 1 wpoly. In Half-Life, the default cut-off for these faces is 240 pixels. If you want to place a 256x256 texture on a 128x128 wall, then you'll have to scale the texture down to 0.5. This will then generate 4 wpolies.
As you can see, the 256x256 texture is a lot sharper, but it'll give you 4 times the amount of wpoly. We can scale this up to 512x512 textures on scale 0.25 but that would increase the wpoly 8 times. If I still want HL:Enriched to run on older systems, going with 512x512 seems out of the question.
In theory I could make a 512x512 version for faster computers, but there is another complication: the lightmap data. In my previous article I wrote about engine limits, specifically the Allocation Block. The size of the lightmap is directly connected to the texture scale. So if I use 512x512 textures, I'm bound to use 0.25 or even 0.125 lightmap scale and I'll fill up the AllocBlock limit almost instantly. This means I couldn't merge any maps together or maybe even not maintain the original maps.
Upscaling textures
The textures I'm using are upscaled version of the original Half-Life textures. These were made with waifu2x-caffe, which is a great, easy-to-use and most importantly free program! The program uses an AI to detect what it is seeing in the image and reconstruct it in a higher resolution. The original textures are often quite blurry, so the final result isn't perfect but quite acceptable for my usecase.
The higher you upscale the texture, the more artifacts and problems become apparent. This is another reason why I'm not using 512x512 texture resolution, because the AI sometimes really misundestands the smaller details.
Alpha testing
If you're taking this new version for a spin, be sure to refer to the changelog. I've made an effort to properly document the changes I've made, so it'll be easier to keep track of bugs and fixes in the future. Thanks for reading and I'll see you next time for one of my favourite chapters: 'We've got Hostiles!'
you using the steam version ? did you think about the detail texture trick ?
The detail texture trick isn't versatile enough for my use and I intend to use detail textures in the future as overlays for the base textures.
Nothing is perfect, so do what you think is important, do it with your soul 👍
The ceiling tiles in the first photo are super misaligned.
It's really hard to align those without changing the shapes of the rooms. The original designers at Valve didn't care much about using proper grid sizes to match floor and ceiling textures. It's a thorn in my side but I've got to make due with what I've been given to work with.