HD emulation mod makes “Mode 7” SNES games look like new

  News
image_pdfimage_print

Gamers of a certain age probably remember being wowed by the quick, smooth scaling and rotation effects of the Super Nintendo’s much-ballyhooed “Mode 7” graphics. Looking back, though, those gamers might also notice how chunky and pixelated those background transformations could end up looking, especially when viewed on today’s high-end screens.

Emulation to the rescue. A modder going by the handle DerKoun has released an “HD Mode 7” patch for the accuracy-focused SNES emulator bsnes. In their own words, the patch “performs Mode 7 transformations… at up to 4 times the horizontal and vertical resolution” of the original hardware.

The results, as you can see in the above gallery and the below YouTube video, are practically miraculous. Pieces of Mode 7 maps that used to be boxy smears of color far in the distance are now sharp, straight lines with distinct borders and distinguishable features. It’s like looking at a brand-new game.

Perhaps the most impressive thing about these effects is that they take place on original SNES ROM and graphics files; DerKoun has said that “no artwork has been modified” in the games since the project was just a proof of concept a month ago. That makes this project different from upscaling emulation efforts for the N64 and other retro consoles, which often require hand-drawn HD texture packs to make old art look good at higher resolutions.

How it works

Games that made use of the SNES “Graphics Mode 7” used backgrounds that were coded in the SNES memory as a 128×128 grid of 256-color, 8×8 pixel tiles. That made for a 1024×1024 “map” that could be manipulated en masse by basic linear algebra affine transforms to rotate, scale, shear, and translate the entire screen quickly [Update: The original version of this story misstated the tileset and resolution for Mode 7 backgrounds. Ars regrets the error].

Some Mode 7 games also made use of an additional HDMA mode (Horizontal-blanking Direct Memory Access) to fake a “3D” plane that stretches off into the horizon. These games would essentially draw every horizontal scanline in a single SDTV frame at a different scale, making pieces lower in the image appear “closer” than ones far away.

It’s a clever effect but one that can make the underlying map data look especially smeary and blob-like, especially for parts of the map that are “far away.” This smearing is exacerbated by the SNES’ matrix math implementation, which uses trigonometric lookup tables and rounding to cut down on the time needed to perform all that linear algebra on ’90s-era consumer hardware. Translating those transformation results back to SNES-scale tiles and a 420p SD screen leads to some problems on the edges of objects, which can look lumpy and “off” by a pixel or two at certain points on the screen.

The HD Mode 7 mod fixes this problem by making use of modern computer hardware to perform its matrix math “at the output resolution,” upscaling the original tiles before any transformations are done. This provides more accurate underlying “sub-pixel” data, which lets the emulator effectively use the HD display and fill in some of the spaces between those “boxy” scaled-up pixels.

For those tilt-shifted HDMA Mode 7 games, the HD mod also eliminates “some limitations of the integer math used by the SNES… by more aggressive averaging,” DerKoun says. This gets rid of those rounding errors from the actual SNES hardware, straightening out lines and positioning tilted background tiles more accurately.

Byuu, the lead coder on the bsnes project, says DerKoun’s HD Mode 7 mod will be integrated into the next major release of the emulator. Then the project will officially join the growing list of other emulation efforts that actually improve on the performance of the original hardware, including WideNES, RetroArch’s LAGFIX latency mitigation and 4K upscaling for PS3 and Wii U games, to name just a few.

Listing image by DerKoun / FrameCompare

https://arstechnica.com/?p=1492535