Disable Post Processing Texture Filtering

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Disable Post Processing Texture Filtering

Post by Indecom »

Just like my titles says, I'm building a post processing shader that involves sampling a texture across the screen, however even with texture filtering in game set to nearest, my sampled texture is still being interpolated. Where abouts can I define GL_NEAREST for this particular texture? It's ruining the effect that I'm going for.
User avatar
ramon.dexter
Posts: 1529
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Disable Post Processing Texture Filtering

Post by ramon.dexter »

And what is the question? Did you know that texture filtering is an option?
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Disable Post Processing Texture Filtering

Post by Nash »

ramon.dexter wrote:And what is the question? Did you know that texture filtering is an option?
Pro-tip: don't answer if you don't fully understand what is being talked about here. =P OP is talking about post processing shaders and how apparently sampling from the screen texture is producing interpolated pixels.


Indecom:

It seems to work for me. I am able to get crisp, clean NEAREST pixels with my post processing stuff. What's your shader like? Can you do a simple shader that simply outputs the frag colour as-is and see if you still get a blurry output?

EDIT: Also just to be sure, do you have settings like multisampling or FXAA, or lens distortion turned on? These 3 PP shaders do cause aliasing on the screen. And lastly, did you accidentally set the screen's scaling factor to something other than 1.0? (it's in the Video Options menu)
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Disable Post Processing Texture Filtering

Post by Indecom »

I've checked the three PP shaders you mentioned and none of them are the culprit. I've got my shader just outputting the frag colour as is and it's definitely blurred. What i've done was assigned a texture uniform in my gldefs like this:

https://i.gyazo.com/84274c9aa81d85c7626d799181b6c9f5

and the function in my shader looks like this:

https://gyazo.com/5ef0ff31befe6823d5f42b070989df18

Texture interpolation is set to: none (nearest mip)
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Disable Post Processing Texture Filtering

Post by Nash »

Hmmm... perhaps the external texture DITH is indeed being interpolated, regardless of user filter settings. I'm not sure and I'm not well-versed with the source, perhaps dpJudas can confirm if this was intentional or a bug.
dpJudas
 
 
Posts: 3044
Joined: Sat May 28, 2016 1:01 pm

Re: Disable Post Processing Texture Filtering

Post by dpJudas »

The user filter settings are meant for scene rendering, not post processing. They have no effect here and that's intentional.

To answer OP - at the moment the screen texture is always nearest sampled and any user texture is always linear sampled. There are currently no settings in the GLDEFS file to change this. You can still get nearest samples from your custom texture, but it requires calling texelFetch() instead of texture().
User avatar
Indecom
Posts: 271
Joined: Mon Jul 13, 2009 3:33 pm

Re: Disable Post Processing Texture Filtering

Post by Indecom »

Thanks all, I managed to figure out my issues and all is working fantastically!

https://i.gyazo.com/29dd307fcdec093d434 ... 42ab39.png
Post Reply

Return to “Assets (and other stuff)”