Tutorial: (Almost) correct detail textures for upscaling WAD textures Last edited 1 year ago2022-09-20 15:48:13 UTC

Note: this tutorial assumes you already know how to make detail textures, set up _detail.txt files and such. In case you don't, refer to this tutorial.

Introduction

You've probably once found yourself in a situation like this:
You have a low-res (say 64x64) WAD texture, and want to apply a high-res (say 512x512) detail texture that is basically the original WAD texture, but in a higher resolution. Some of you are doing this in order to save on AllocBlock, others are probably making HD textures for existing maps, and some of you probably just wanna experiment. You've all come to the right place.

Here's the original texture:
User posted image
Here's the WAD texture:
User posted image
If you used the original texture as the detail texture, with no changes, you'd get this in-game:
User posted image
It looks detailed, but the colours are now messed up. "Aha", you say, "I can just desaturate the detail texture!"
At first glance, that sounds like a good workaround until you actually try it out:
User posted image
Yay, now the colours are alright, but it still looks bad and quite different than the original.

So, how do we do this properly?

How-to

1. Begin by grabbing both the original texture and the low-res texture, as top & bottom layers respectively.
In this image, it's accidentally in reverse order - original should be top, lowres should be bottomIn this image, it's accidentally in reverse order - original should be top, lowres should be bottom
2. Resize the "lowres" layer to be the same size as your "original" layer, using linear interpolation. (this is quite important, since most HL players use gl_texturemode GL_LINEAR_MIPMAP_LINEAR)
Then center it.

3. Set the "original" layer's blending mode to "Grain extract".
User posted image
4. Create a new layer from visible, and disable the original layer:
User posted image
5. Invert the colour of this new layer:
User posted image
6. Optionally, to "simulate" in the image editor how this would look in-game, set the detail layer's blending mode to "Overlay".
User posted image

End notes

And that's it. The title of the tutorial says it's almost correct because there is still some difference between the original texture and the resulting detail+diffuse texture, but it's very subtle.
Can you guess which is which?Can you guess which is which?
Here's that same wall, but in the map editor:
User posted image

Linear vs. nearest

If you used nearest/no interpolation instead of linear, then the detail texture would look correct if gl_texturemode begins with GL_NEAREST. This way, the texture would look entirely correct in any GL_LINEAR combination, but it'd look kinda chunky in GL_NEAREST. Pay attention to the individual rocks and pebbles here:
GL_NEAREST_MIPMAP_LINEAR; linear interpolationGL_NEAREST_MIPMAP_LINEAR; linear interpolation
GL_LINEAR_MIPMAP_LINEAR; linear interpolationGL_LINEAR_MIPMAP_LINEAR; linear interpolation
If you want to cater to the "nearest" audience, then you can use nearest/no interpolation when resizing the low-res texture.

3 Comments

Commented 1 year ago2022-10-05 10:41:01 UTC Comment #104832
What blending mode would I use for Paint.NET?
Commented 1 year ago2023-01-20 09:24:45 UTC Comment #105013
What blending mode would I use for Paint.NET?
It does not seem like Paint.NET 5.0 natively has the Grain Extract blend mode. It's possible there might be a plugin for it but I haven't checked.
GIMP is another free image editor that does have Grain Extract blend mode and so I would suggest using that instead.
Commented 1 year ago2023-01-20 09:30:53 UTC Comment #105014
I'd like to add that step 4 can be skipped by reversing the layer order, i.e. place the scaled lowres layer on top of the original and applying the blend mode to this.
This produces the exact same result but without a colour invert step.

You must log in to post a comment. You can login or register a new account.