Texture filtering

From Emulation General Wiki
Revision as of 22:40, 3 June 2014 by Net Bastard (talk | contribs)
Jump to navigation Jump to search
A comparison between nearest neighbor scaling and HQ2x scaling

In computer graphics, texture filtering or texture smoothing is the method used to smooth textures used in 3D models. Some consoles use texture filtering.

In emulation, texture filtering can be applied even if the original console did not use it. Many emulators support such features.

Consoles

Console Texture Filtering Types of filtering
Super Nintendo
3DO ?
Atari Jaguar
Sega Saturn
PlayStation
Nintendo 64 Three-sample bilinear
Sega Dreamcast Bilinear, trilinear, anisotropic
PlayStation 2 Bilinear, trilinear, Anisotropic
GameCube Bilinear, trilinear, anisotropic
Xbox Bilinear, trilinear, anisotropic
Nintendo DS ?
PlayStation Portable Bilinear, trilinear
Wii Bilinear, trilinear, anisotropic

Types of Texture Filtering

Filtering type What it does Pros Cons
Nearest neighbor Basically, it looks the exact same as having no filter whatsoever.
  • Very fast.
  • Looks good for 2D games if you want to keep the pixel art aesthetic.
  • 3D games look terrible.
  • It's unfiltered pixels. You should know what to expect.
Nearest Neighbor with Mipmapping Exactly what it says on the tin: Nearest-neighbor filtering with mipmapping. Mipmapping is basically level of detail for textures. The farther away a texture is in a 3D space, the lower the resolution is. This can continue until the texture is completely flat.
  • Even faster than regular nearest neighbor.
  • 3D games look terrible.
Bilinear This linear filtering method uses color data from the pixels in a nearest-neighbor texture, and combines multiple bits of color data in order to replace some of the pixels with an averaged-out version of the colors, so that the colors gradually switch rather than jump to a new color.
  • Looks better than nearest neighbor for 3D games.
  • It's the least system-intensive form of texture filtering/scaling.
  • 2D games look atrocious.
  • If you have the specs to use them, every other filtering option is better.
Trilinear This linear filtering method does the same thing as bilinear filtering, except it passes through twice, giving a smoother gradient.
  • Looks better than bilinear filtering for 3D games.
  • 2D games look atrocious.
Anisotropic Uses oddly-shaped copies of texture parts in order to smooth out pixelated/blurred edges in nearest neighbor/linear filtered images. Higher sample amounts (e.g. 4x, 8x, 16x) will shape the textures into more complex shapes as needed.
  • Looks much better than just linear filtering for 3D games.
  • Can be used alongside other filters and scaling algorithms for even smoother-looking textures.
  • High sample amounts are system-intensive.
  • Not recommended for 2D games.
HQx A texture scaling algorithm. Scales up a nearest-neighbor version of the texture and fills in the gaps with copies of the pixels next to said gaps.
  • Looks great for many 2D games.
  • Artifacts are common.
  • Curves and slopes that aren't 45­° look jagged compared to everything else.
  • The finer details of the textures/sprites might be obscured by bad edge detection.
  • Posterization is very common. There are deposterization filters in some emulators (e.g. PPSSPP) that can aid this, however.
  • Worse at some things that xBR excels at.
2xSaI A texture scaling algorithm. Scales the texture and fills edges in with a mixture of pixels taken from the source and randomly-guessed colors.
  • Less system-intensive than HQx and xBR.
  • Adequate if it's the best option available (e.g. in Pete's OpenGL2 plugin for PSX emulators).
  • Edge detection is horrible.
  • Artifacts are common.
  • Posterization is very common.
  • Archaic. The alternatives are much better.
xBR A modified version of HQx. It detects edges better, which works better for curved lines, or for slopes that are greater than/less than 45 degrees.
  • Looks great for many 2D games.
  • Edge detection is improved over HQx. This gives textures smoother curves and slopes, as well as fewer artifacts.
  • 3D games look great with it as well.
  • Posterization is common. There are deposterization filters in some emulators (e.g. PPSSPP) that can aid this, however.
  • The finer details of the textures/sprites might be obscured by bad edge detection.
  • Worse at some things that HQx excels at.
xBRZ A modified version of xBR, which is very similar except it's better at scaling up smaller features consisting of <10 pixels.
  • Looks great for many 2D games.
  • Detects small features that get messed up by HQx and xBR.
  • 3D games look great with it as well.
  • Posterization is common. There are deposterization filters in some emulators (e.g. PPSSPP) that can aid this, however.
  • Worse at some things the other scalers excel at.

Durante's Hybrid and Deposterization Filters for PPSSPP

PPSSPP has a scaling option known as "Hybrid." There's also an option called "Deposterize." Posterization, meaning a sharp contrast in hue from one pixel to another (very common in low-quality gifs) has been a problem plaguing texture scaling algorithms for quite some time. Durante's filter switches between xBR and bilinear/bicubic filtering depending on the texture information. On top of this, the "Deposterize" option tackles posterization edges in compressed textures, allowing for a smooth gradient rather than a sharp transition. Although it's not perfect (a perfect scaler sadly isn't possible with today's computing power) it's still great and it's recommended to use for PPSSPP if you have the specs.

Images


Further reading

Wikipedia's entry on Texture Filtering

Forum post from the creator of xBR, explaining how the algorithm works (Warning: is slightly hard to read due to the amount of jargon and big words)

A blog entry by Durante on creating a hybrid texture filter for PPSSPP.