Texture filtering: Difference between revisions
| (32 intermediate revisions by 15 users not shown) | |||
| Line 1: | Line 1: | ||
[[File:Nearest_Neighbor_2x_versus_HQ2x.png|thumb|A comparison between nearest neighbor scaling and HQ2x scaling]] | [[File:Nearest_Neighbor_2x_versus_HQ2x.png|thumb|300px|A comparison between nearest neighbor scaling and HQ2x scaling]] | ||
:''This article is about smoothing techniques that may be present even on original hardware. For the process of replacing textures to improve their visual fidelity or other aesthetic reasons, see [[Texture Packs]].'' | |||
'''[[wikipedia:Texture filtering|Texture filtering]]''' refers to the methods used to smooth the textures of a 3D model. Every home console after the [[Nintendo 64 emulators|Nintendo 64]] is able to do it, including every modern PC and Android device. This makes it useful in emulation, where it can be applied to emulators for consoles that did not originally have it through various emulators that support it. | |||
{| class="wikitable" style="text-align:center;" | |||
{| class="wikitable" | |||
! scope="col"|Console | ! scope="col"|Console | ||
! scope="col | ! scope="col"|Texture Filtering | ||
! scope="col | ! scope="col"|Types of filtering | ||
|- | |- | ||
|[[Super Nintendo emulators|Super Nintendo]] | | style="text-align:left;" |[[Super Nintendo emulators|Super Nintendo]] | ||
| | |{{✗}} | ||
| | |||
|- | |- | ||
|[[3DO emulators|3DO]] | | style="text-align:left;" |[[3DO emulators|3DO]] | ||
| | |{{✗}} | ||
|? | |||
|- | |- | ||
|[[Atari Jaguar emulators|Atari Jaguar]] | | style="text-align:left;" |[[Atari Jaguar emulators|Atari Jaguar]] | ||
| | |{{✗}} | ||
| | |||
|- | |- | ||
|[[Sega Saturn emulators|Sega Saturn]] | | style="text-align:left;" |[[Sega Saturn emulators|Sega Saturn]] | ||
| | |{{✗}} | ||
| | |||
|- | |- | ||
|[[PlayStation emulators|PlayStation]] | | style="text-align:left;" |[[PlayStation emulators|PlayStation]] | ||
| | |{{✗}} | ||
| | |||
|- | |- | ||
|[[Nintendo 64 emulators|Nintendo 64]] | | style="text-align:left;" |[[Nintendo 64 emulators|Nintendo 64]] | ||
| | |{{✓}} | ||
|Three-sample | |||
|- | |- | ||
|[[Sega Dreamcast emulators|Sega Dreamcast]] | | style="text-align:left;" |[[Sega Dreamcast emulators|Sega Dreamcast]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear, anisotropic | |||
|- | |- | ||
|[[PlayStation 2 emulators|PlayStation 2]] | | style="text-align:left;" |[[PlayStation 2 emulators|PlayStation 2]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear, Anisotropic | |||
|- | |- | ||
|[[GameCube emulators|GameCube]] | | style="text-align:left;" |[[GameCube emulators|GameCube]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear, anisotropic | |||
|- | |- | ||
|[[Xbox emulators|Xbox]] | | style="text-align:left;" |[[Xbox emulators|Xbox]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear, anisotropic | |||
|- | |- | ||
|[[Nintendo DS emulators|Nintendo DS]] | | style="text-align:left;" |[[Nintendo DS emulators|Nintendo DS]] | ||
| | |{{✗}} | ||
|? | |||
|- | |- | ||
|[[PlayStation Portable emulators|PlayStation Portable]] | | style="text-align:left;" |[[PlayStation Portable emulators|PlayStation Portable]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear | |||
|- | |- | ||
|[[Wii emulators|Wii]] | | style="text-align:left;" |[[Wii emulators|Wii]] | ||
| | |{{✓}} | ||
|Bilinear, trilinear, anisotropic | |||
|} | |} | ||
== | ==Texture Filtering Algorithms== | ||
These methods determine how a texture is sampled and displayed on a 3D model in real-time. They are generally native to original hardware or forced via emulator enhancement settings. | |||
{| class="wikitable | {| class="wikitable" style="text-align:center;" | ||
! scope="col"|Filtering type | |||
! scope="col | ! scope="col"|What it does | ||
! scope="col | ! scope="col"|Pros | ||
! scope="col | ! scope="col"|Cons | ||
|- | |- | ||
|'''Nearest neighbor''' | |||
| | |The GPU picks the color of the single closest pixel in the original texture. | ||
| style | | | ||
* | * Preserves sharp pixel-art style. | ||
| | * Lowest computational cost. | ||
*3D | | | ||
* Causes "shimmering" or "aliasing" in motion. | |||
* 3D textures look "blocky" up close. | |||
|- | |- | ||
|'''Bilinear''' | |||
| | |Averages the color data of the 4 closest pixels to create a smooth transition. | ||
| | |||
*Looks better than nearest neighbor for 3D games. | *Looks better than nearest neighbor for 3D games. | ||
*It's the least system-intensive form of texture filtering/scaling. | *It's the least system-intensive form of texture filtering/scaling. | ||
| | |||
* | * Can look "blurry," especially on low-resolution textures. | ||
* | * Does not look good for 2D sprites. | ||
|- | |- | ||
|'''Trilinear''' | |||
| | |An extension of Bilinear that interpolates between mipmaps (different resolution versions of the same texture). | ||
| | | | ||
* Eliminates visible "lines" or "bands" between texture quality levels in the distance. | |||
| | |||
* | * Still produces blurriness at sharp viewing angles. | ||
|- | |- | ||
|'''Anisotropic (AF)''' | |||
| | |Enhances texture quality on surfaces viewed at oblique angles (like floors or walls). | ||
| | |||
* | * Drastically improves clarity for distant textures. | ||
* | * Modern GPUs handle this with almost zero performance loss. | ||
| style="text-align: center;"| | | | ||
* Not available on older legacy hardware. | |||
|} | |||
==Texture Scaling Algorithms== | |||
{{for|smoothing shaders|Shaders, presets and filters#Smoothing}} | |||
These are enhancement algorithms (often called "upscalers") used by emulators to increase the resolution of textures to look better on modern displays. | |||
{| class="wikitable" style="text-align:center;" | |||
! scope="col"|Scaling Algorithm | |||
! scope="col"|What it does | |||
! scope="col"|Pros | |||
! scope="col"|Cons | |||
|- | |- | ||
|'''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. | |||
| | |||
* | *While it is inherently destructive, some games (eg. Yoshi's Island) may benefit from this filter, as it preserves the cartoony look. | ||
| | |||
*Artifacts are common. | *Artifacts are common. | ||
*Curves and slopes that aren't | *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. | *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. | *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. | *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. | *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). | *Adequate if it's the best option available (e.g. in Pete's OpenGL2 plugin for PSX emulators). | ||
| | |||
*Edge detection is horrible. | *Edge detection is horrible. | ||
*Artifacts are common. | *Artifacts are common. | ||
| Line 135: | Line 137: | ||
*Archaic. The alternatives are much better. | *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. | *Looks great for many 2D games. | ||
*Edge detection is improved over HQx. This gives textures smoother curves and slopes, as well as fewer artifacts. | *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. | *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. | *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. | *The finer details of the textures/sprites might be obscured by bad edge detection. | ||
*Worse at some things that HQx excels at. | *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. | *Looks great for many 2D games. | ||
*Detects small features that get messed up by HQx and xBR. | *Detects small features that get messed up by HQx and xBR. | ||
*3D games look great with it as well. | *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. | *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. | *Worse at some things the other scalers excel at. | ||
|- | |||
|'''MMPX''' | |||
|A texture scaling algorithm. Provides a nearly unfiltered, "Retro Plus" pixel art aesthetic with better handling of rounded and diagonal edges, similar to that found in many indie games. | |||
| | |||
*Has better handling of diagonals and curves than other scalers. | |||
*Does not alter the art style to look cartoonish or posterized the way HQx and xBR do. | |||
*Looks great for both 2D and 3D games designed with pixelated graphics in mind. | |||
| | |||
*Looks pixelated, highlighting the low resolution. | |||
*Textures scaled horizontally and vertically at unequal levels can produce awkward results. [https://old.reddit.com/r/finalfantasytactics/comments/10iqeph/i_spent_a_couple_of_hours_testing_ppsspps/ Resolution hacks] may be able to fix this in some instances. | |||
|- | |||
|'''NNEDI3''' | |||
|A neural network-based "edge-directed" interpolator. It uses a pre-trained model to predict what missing pixels should look like based on existing edges and structures. | |||
| | |||
*Exceptional at preserving sharp edges without the "oil painting" look of xBRZ. | |||
*Virtually eliminates jagged edges (aliasing) on 2D elements and UI. | |||
*Considered one of the highest-quality "clean" upscalers available. | |||
| | |||
*Extremely hardware intensive compared to every other filter on this list; requires a capable GPU. | |||
*Can sometimes introduce small "wobbles" or artifacts in very complex, noisy textures where the AI misidentifies an edge. | |||
|- | |||
|'''ArtCNN''' | |||
|A lightweight Convolutional Neural Network (CNN) designed for real-time upscaling and artifact removal. It uses machine learning to reconstruct sharp edges and smooth gradients. | |||
| | |||
*Produces some of the cleanest results for 2D art and UI elements. | |||
*Excellent at removing "ringing" and compression artifacts that other scalers might amplify. | |||
*Provides a much more natural, "hand-drawn" look compared to the "oil painting" effect of xBRZ. | |||
*Highly optimized; much faster than NNEDI3 while providing similar or better visual clarity. | |||
| | |||
*Requires a GPU that supports modern shader languages (Vulkan/GLSL/HLSL). | |||
*Can occasionally "over-clean" textures, removing intentional film grain or fine grit in 3D textures. | |||
*May be too demanding for very low-end integrated graphics or older mobile devices. | |||
|} | |} | ||
==Durante's | ==Emulator Specific== | ||
These are specific options found in emulators like [[PPSSPP]] that modify or combine the methods listed above to achieve better results. 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. | |||
{| class="wikitable" style="text-align:center;" | |||
! scope="col"|Feature | |||
! scope="col"|What it does | |||
! scope="col"|Pros | |||
! scope="col"|Cons | |||
|- | |||
|'''Hybrid / Hybrid + Bicubic''' | |||
|A scaling method that switches between xBR and bilinear/bicubic filtering depending on the texture information. It attempts to detect which parts of a texture need sharp edge enhancement and which are smooth gradients. | |||
| | |||
*The "best of both worlds": preserves sharp edges where needed while keeping smooth areas (like skies) from looking blocky or "posterized." | |||
*Generally considered the "Gold Standard" for a balanced look in PPSSPP if the hardware can handle it. | |||
| | |||
*Highly system-intensive. | |||
*While it aims for a perfect balance, a perfect scaler isn't possible with today's computing power, so some textures may still look slightly inconsistent. | |||
|- | |||
|'''Deposterize''' | |||
|A filter that tackles "posterization" (sharp, ugly jumps in color hue common in compressed textures) by smoothing out the transitions into a natural gradient. | |||
| | |||
*Allows for a smooth gradient rather than a sharp, blocky transition in colors. | |||
*Greatly reduces the "oil painting" artifacts that often plague other texture scaling algorithms. | |||
*Highly recommended for use in PPSSPP if you have the specs to support it. | |||
| | |||
*Can occasionally "wash out" textures where sharp color transitions were an intentional part of the art style. | |||
*Adds extra load to the GPU when combined with high-level scalers. | |||
|} | |||
==Images== | ==Images== | ||
| Line 180: | Line 239: | ||
</gallery> | </gallery> | ||
==Texture filtering hacks== | |||
Some emulators features better texture filtering: enhancement option for providing better texture filtering methods comparing the original hardware had. | |||
See; | |||
*[[Wii emulators#Enhancements]] | |||
*[[GameCube emulators#Enhancements]] | |||
*[[Dreamcast emulators#Enhancements]] | |||
*[[Nintendo 64 emulators#Enhancements]] | |||
*[[PlayStation 2 emulators#Enhancements]] | |||
*[[Xbox emulators#Enhancements]] | |||
*[[Nintendo DS emulators#Enhancements]] | |||
*[[PlayStation Portable emulators#Enhancements]] | |||
sections. | |||
==Framebuffer Scaling & Output Methods== | |||
{{Main|Scaling}} | |||
==Further reading== | ==Further reading== | ||
* [https://web.archive.org/web/20140904180543/http://board.byuu.org/viewtopic.php?f=10&t=2248 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) | |||
[ | * [http://blog.metaclassofnil.com/?p=306 A blog entry by Durante on creating a hybrid texture filter for PPSSPP.] | ||
* [https://casual-effects.com/research/McGuire2021PixelArt/index.html The original academic paper explaining the MMPX algorithm] (Warning: This is very dense and contains a great deal of jargon) | |||
* [https://dolphin-emu.org/blog/2025/06/04/dolphin-progress-report-release-2506/#2503-122-use-game-requested-anisotropic-filtering-by-pokechu22-and-billiard Use Game Requested Anisotropic Filtering - Dolphin blog 2025/06/04] | |||
* [https://github.com/hrydgard/ppsspp/pull/21527 PPSSPP PR: #21527 - NNEDI3 and Spline36 GPU texture scaling] | |||
[http://blog.metaclassofnil.com/?p=306 A blog entry by Durante on creating a hybrid texture filter for PPSSPP.] | |||
[[Category:FAQs]] | [[Category:FAQs]] | ||