Replicating cards' bilinear filtering in shader?

Emulation of old PCs, PC hardware, or PC peripherals.

Replicating cards' bilinear filtering in shader?

Postby leileilol » 2019-3-05 @ 14:40

First and foremost, this is not a Reshade whatever.

Months ago I was trying to hack together a fragment shader for textures to drop the taps of bilinear filtering far lower and started off with round()ing the texcoords based on the texture size divided by taps determined by nearest texel color differences. Unfortunately this led to a lot of corrupt stuff like one diagonal slice getting 4 taps and the rest getting 32 etc. so obviously this approach is wrong.
screwedup.png

is there a more proper way of doing it? Thinking about the MIP LOD as a shader too, somehow, as with new bilinear filtering using textureSize would need to require that.

I was intending to replicate the low precise filtering on PowerVR hardware (PVR1 to 3, but especially PVR1 for the characteristic far less precise alpha channel filtering) and the Geforces (about all before 6) and had made some study materials zooming into texels and analyzing what taps were given for what color value etc.
geforc.png
Geforce filtering example

pvr1filt.png
PCX2 filtering example
pvr1filt.png (5.38 KiB) Viewed 167 times
by the way, DOSBox is not for running Windows 9x
User avatar
leileilol
l33t++
 
Posts: 9798
Joined: 2006-12-16 @ 18:03

Return to PC Emulation

Who is online

Users browsing this forum: knowledge [bot] and 2 guests