[No] Gamma-correct bilinear filtering as an option

Moderator: GZDoom Developers

Gamma-correct bilinear filtering as an option

Postby axredneck » Sat Jun 04, 2022 6:02 pm

That's how GZDoom and old games do bilinear filtering:
W65B_2-old.png

That's how FTEQW, GIMP, Blender and modern game engines do it:
W65B_2-correct.png

It's especially noticeable on motley (e.g. heavily dithered) textures.
You do not have the required permissions to view the files attached to this post.
User avatar
axredneck
excuse me for my bad English
 
Joined: 11 Dec 2017
Location: Russia
Github ID: axredneck
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Gamma-correct bilinear filtering as an option

Postby Rachael » Sat Jun 04, 2022 6:18 pm

In order to do this correctly the entire scene would have to be rendered in a (2.2) gamma and then render it back with a (1.0/2.2) gamma in post. I don't think there is any other way to do this to get the desired result.

Then dynamic lights would have to be adjusted to fade with the new gamma ramp. Not even sure how fog will work.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma-correct bilinear filtering as an option

Postby Chris » Sat Jun 04, 2022 9:05 pm

Having a gamma-correct rendering pipeline would be nice, especially for PBR stuff for more accurate lighting. But yeah, all currently available content is expecting sRGB rendering/blending so there'd have to be some method to opt-in to it when the content can expect it, probably at a game level.
User avatar
Chris
 
Joined: 17 Jul 2003
Operating System: Debian-like Linux (Debian, Ubuntu, Mint, etc) 64-bit
Graphics Processor: ATI/AMD with Vulkan Support

Re: Gamma-correct bilinear filtering as an option

Postby Nash » Sat Jun 04, 2022 9:52 pm

The color difference demonstrated in the OP is even more obvious on this IPS monitor I'm using. I didn't even realize this was a thing before this. :O

The bottom one looks much more pleasing to the eyes, too.
User avatar
Nash
AKA Nash Muhandes! Twitter/Facebook/Youtube: nashmuhandes
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Twitch ID: nashmuhandes
Github ID: nashmuhandes

Re: Gamma-correct bilinear filtering as an option

Postby Rachael » Sat Jun 04, 2022 10:12 pm

Yes - it makes linear filtering a lot more tolerable.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma-correct bilinear filtering as an option

Postby Graf Zahl » Sat Jun 04, 2022 11:38 pm

That's a bad texture for demonstration.

In any case, you'll need someone with better technical knowledge of how to implement it. It seems to involve a major rework of the entire renderer. I'm not going to do this myself.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Gamma-correct bilinear filtering as an option

Postby axredneck » Sun Jun 05, 2022 9:45 am

Graf Zahl wrote:That's a bad texture for demonstration.

Yes, most textures look OK-ish. I showed this texture on purpose as extreme case among actual Doom textures.
User avatar
axredneck
excuse me for my bad English
 
Joined: 11 Dec 2017
Location: Russia
Github ID: axredneck
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Gamma-correct bilinear filtering as an option

Postby axredneck » Sun Jun 05, 2022 9:50 am

Rachael wrote:In order to do this correctly the entire scene would have to be rendered in a (2.2) gamma and then render it back with a (1.0/2.2) gamma in post. I don't think there is any other way to do this to get the desired result.

Doesn't Vulkan have some better way of doing it?
User avatar
axredneck
excuse me for my bad English
 
Joined: 11 Dec 2017
Location: Russia
Github ID: axredneck
Operating System: Other Linux 64-bit
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Gamma-correct bilinear filtering as an option

Postby Rachael » Sun Jun 05, 2022 10:00 am

The last thing we need to do is increase the complexity of the renderer when an option is available that provides more of a correct render for all elements rather than just the textures themselves. Putting in a change for just the textures would introduce an unnecessary complexity that would interfere with a better and more comprehensive solution which if implemented would solve this issue anyhow.
User avatar
Rachael
^ walking stack of unfinished projects ^
Admin
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

Re: Gamma-correct bilinear filtering as an option

Postby dpJudas » Sun Jun 05, 2022 2:06 pm

There is no real difference here between OpenGL and Vulkan. In both cases it involves setting the texture format to sRGB so that the linear sampling filter will interpolate correctly. Unfortunately that then creates a linear output. The easiest way to deal with that would be to then reapply the sRGB gamma right after the texture(tex, pos) call in the GLSL code.

If Doom was a modern game with complex modern lights this might be worth it. For Doom? It would make it run worse on lower end hardware for a very minor visual improvement for higher end. I'd say it isn't worth it. In any case, I won't try do it because I'm in the nearest filtering camp anyway. ;)
dpJudas
 
 
 
Joined: 28 May 2016

Re: Gamma-correct bilinear filtering as an option

Postby Graf Zahl » Sun Jun 05, 2022 2:25 pm

That settles it. I fail to see the appeal if you need the ugliest texture in all of Doom to demonstrate the difference. Personally I never perceived the filtering as-is as incorrect.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 0 guests