[Added] NormalNX texture resizing

Moderator: Raze Developers

Re: NormalNX texture resizing

Postby Graf Zahl » Sat Oct 17, 2020 2:11 pm

I am more talking about the color distortion, it's a lot less severe in Blood than in the other games. Even with 64 levels it still needs to work with 256 colors.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: NormalNX texture resizing

Postby sinisterseed » Sat Oct 17, 2020 2:26 pm

markanini wrote:At least for the former it should be possible to implement in a more future proof way if you only care about the general look of colors and not about all weird quirks of aging technology.

I could be horribly wrong but I think such a method is possible.

I seem to recall that what Fresh Supply did was not the traditional palette emulation but something else, and they looked up the colors in a lookup table to generate the original aesthetic. Edward explained this in short once, but don't quote me on that, my memory is quite fuzzy on this topic and I am mainly talking from memories.
User avatar
sinisterseed
Raze/GZDoom RO Translator & Raze Tester
 
Joined: 05 Nov 2019
Twitch ID: nixchievousfox
Github ID: sinisterseed
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: NormalNX texture resizing

Postby markanini » Sun Oct 18, 2020 1:12 am

It's functionally the same. Palette emulation and color look up tables could be considered interchangeable.
People do similar things today all the time in the form or film-like emulation for video content.
What's missing is creating a look up table in a high precision 3D space, where you would sample the reference colors while allowing for a smooth ramping between values.

Graf Zahl wrote:Yeah, surely you can downconvert them to the palette again, but the real advantage of doing an upscale tends to get lost if you lose all those color gradients again due to lack of available colors and the result tends to lool like total garbage, especially if you use the internal real-time scalers.

This makes modding for build games frustrating, so many roadblocks to adding higher quality resources. Audio is also very limited.
markanini
 
Joined: 18 Jan 2020

Re: NormalNX texture resizing

Postby Graf Zahl » Sun Oct 18, 2020 1:34 am

Strictly speaking "Palette 'emulation'" is a misnomer. It doesn't 'emulate' the palette - it actually uses it, so 'palette lookup mode' would be technically more precise. "Color table" and "Palette" are synonyms for the same thing anyway.

Regarding high precision lookups, surely they could be done, but the space requirements would be prohibitive. Polymer supports a limited subset of such lookups to allow using the palette translation effects on true color images, i.e. doing precisely this, but only for the first shade level. This results in 69 PNGs, each roughly 200kb on disk and 3 MB in memory. each.
To now do proper shading you need to do the same a second time, with 32 lookups per base palette, i.e. 96 files of the same type again. You do the math where this will end up memory-wise if it was done for all games. Blood would be particularly problematic because it does not have 3 base palettes but 7, and 64 shade levels instead of 32 for Duke. Shadow Warrior uses a lot of different palette translations so its memory requirements would also be huge.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: NormalNX texture resizing

Postby markanini » Sun Oct 18, 2020 2:04 am

Rendering on run-time doesn't sound great either, I certainly wouldn't like staring at a loading screen telling me to wait for color tables to compute.
markanini
 
Joined: 18 Jan 2020

Re: NormalNX texture resizing

Postby Graf Zahl » Sun Oct 18, 2020 2:26 am

You can't compute these things, they need to be hand created. Otherwise you'd just end up with a natural fade to black as the hardware renderer already does.
The only reason why palette emulation even exists is that these tables were apparently hand-'optimized'.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: NormalNX texture resizing

Postby markanini » Sun Oct 18, 2020 2:35 am

What you could put into the engine is someone creative re-imagining of how the color tables would look in a higher precision space. But I disagree with this on principle. It's better suited as a separate community project(and pre-calculated).
markanini
 
Joined: 18 Jan 2020

Re: NormalNX texture resizing

Postby sinisterseed » Sun Oct 18, 2020 3:08 am

So, all things considered, with all its drawbacks it looks like the current method is still the best.

I didn't know doing it another way would actually be so taxing.
User avatar
sinisterseed
Raze/GZDoom RO Translator & Raze Tester
 
Joined: 05 Nov 2019
Twitch ID: nixchievousfox
Github ID: sinisterseed
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: NormalNX texture resizing

Postby Phredreeke » Sun Oct 18, 2020 3:20 am

I think the first question that needs to be asked is, are we dealing with 8-bit or true color textures? If the former then what markanini is suggesting would be sufficient. I would imagine an algorithm parsing each color in the shade table, and for every section of identical entries interpolate using the neighbouring different shades.

But as Graf says, for true color it gets trickier. Could something be done where you pick the closest color in the palette, subtract that from the texture color, shade the difference linearly then add that back to the color taken from the shade table?

I gotta see later if I can make some mockup of the result...
User avatar
Phredreeke
 
Joined: 10 Apr 2018
Discord: phredreeke#6500

Re: NormalNX texture resizing

Postby Graf Zahl » Sun Oct 18, 2020 3:52 am

Not in real time in a shader. But no matter what you do, unless you do a true color lookup you can very much forget about any kind of texture filtering because it obliterates the palette entry so you'd be forced to do a true color lookup. That means no mipmapping, no anisotropic filtering and basically no aliasing reduction.

Regarding the creation of a lookup by interpolating the shade table, keep in mind that the lower shade levels suffer from severe color crushing, a good example for this would be the walls of the grave at the start of Blood's E1M1 or the total loss of color precision in some darker places in Doom. You cannot reconstruct a working true color setup from that, unless doing it manually.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: NormalNX texture resizing

Postby sinisterseed » Sun Oct 18, 2020 4:31 am

Then I guess the old school palette emulation is here to stay the way it is, as a second class citizen.

I'm totally fine with that, for reasons mentioned previously. But in the case of aliasing, at least its effects in the distance can be more-or-less countered with MSAA, and with higher resolutions. Granted that means slightly more stress on the hardware for results that will obviously not be the exact same, but it's a good compromise IMO.

In 1080p, palette emulation looks really good with with 4x MSAA or more.
User avatar
sinisterseed
Raze/GZDoom RO Translator & Raze Tester
 
Joined: 05 Nov 2019
Twitch ID: nixchievousfox
Github ID: sinisterseed
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: NormalNX texture resizing

Postby Graf Zahl » Sun Oct 18, 2020 5:59 am

sinisterseed wrote:In 1080p, palette emulation looks really good with with 4x MSAA or more.



I cannot agree. MSAA doesn't do anything inside a polygon, only around its edges, I do not see any difference with it on or off. In both case there's strong aliasing in 1080p.
The only way I can reduce it to a tolerable level is with mipmapping enabled.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: NormalNX texture resizing

Postby sinisterseed » Sun Oct 18, 2020 6:47 am

Graf Zahl wrote:
sinisterseed wrote:In 1080p, palette emulation looks really good with with 4x MSAA or more.

I cannot agree. MSAA doesn't do anything inside a polygon, only around its edges, I do not see any difference with it on or off. In both case there's strong aliasing in 1080p.
The only way I can reduce it to a tolerable level is with mipmapping enabled.

Yes, and that was my main issue there.

The image is significantly less jagged in the distance with MSAA even in paletted mode, and the edges of things are smoother as well.
User avatar
sinisterseed
Raze/GZDoom RO Translator & Raze Tester
 
Joined: 05 Nov 2019
Twitch ID: nixchievousfox
Github ID: sinisterseed
Operating System: Windows 10/8.1/8/201x 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: NormalNX texture resizing

Postby ZellSF » Fri May 28, 2021 10:23 am

Works for textures now with the new render, still has to be set via console variables each start...

But it's great to see Duke Nukem 3D looking fantastic while only using 100W of GPU power (previously I was supersampling so it was 250W and it looked worse).

Also thought "am I missing out on having proper colors with palette emulation", but each time I turn it on... :blergh: . Either terrible banding (without interpolation) or weird color shifting. I have no idea why eDuke32 developers thought that was worth giving up texture filtering for.
ZellSF
 
Joined: 13 Aug 2019
Operating System: Windows 10/8.1/8/201x 64-bit
Graphics Processor: nVidia (Modern GZDoom)

Re: NormalNX texture resizing

Postby markanini » Fri May 28, 2021 11:25 am

I typed gl_texture_hqresizemode 6, gl_texture_hqresizemulti 4. into the console. Looks great, no more interference patterns.
markanini
 
Joined: 18 Jan 2020

PreviousNext

Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests