code block
Thread review | |
---|---|
creaothceann | https://www.reddit.com/r/emulation/comments/btcw7i/bsneshd_beta_6_bsnes_1073_formally_hd_mode_7_mod/ |
Screwtape | I've started tracking DerKoun's releases in a branch of the unofficial higan repo, so (for example) you can review the actual beta 4 changes instead of the complete copies of modified files in the official release archive. |
creaothceann | HD Mode 7 mod, beta 4 (bsnes 107.3): WideScreen (fullscreen 1080p) |
hunterk | I just pushed up a variant of the super-xbr-3d shaders that combines the 2x and 4x versions into one and should react to resolution changes with the appropriate codepath. It's called super-multi-xbr-3d. Let me know how it goes :) |
MamiyaOtaru |
Posted by byuu Any upscaling shaders in the quark shader repository are already non-working in HD mode 7. The only exception is super-xbr-3d (that hunterk ported over specifically in response to HD mode 7). Which is broken in menus now due to them not rendering at the same resolution as the mode 7 parts of games. Outputting that many pixels isn't something I'd want to do all the time for sure, but if I already (optionally!) have HD mode 7 on and am outputting that many when in mode 7 anyway, I wouldn't mind doing so in menus too, if at least one upscaling shader would work for the whole game. Currently with HD mode 7 I can either apply a single upscaling shader to the menu, or to the on track portion of Mario Kart, but not both, which was possible before. Whether that's a good reason to change things or not, am I at least making sense (phobia of sounding dumb)? Have you tried running HD mode 7 in conjunction with any upscaling shaders? Would you consider that something worth being able to do? Anyway, really grateful for your work! |
CaptainJistuce | To add on, the graphics chipset offers eight background modes of varying capabilities. And instead of descriptive names like "high-res mode" and "cool 3D effects mode", they were officially identified by the numbers 0 through 7. The numbers were assigned because they were the number you had to feed the PPU to make it shift into the desired mode. |
creaothceann |
Posted by Kawa To be more precise, it's a 'background (decoding) mode'. It tells the SNES how to fetch and translate the graphics for the background layers, and can be specified per line. Sprites are not affected. There are several screen modes, depending on some bits: - 224 or 239 lines per field (basically, NTSC or PAL) - progressive (default) or interlaced fields (most useful for BG modes 5 and 6) |
Kawaoneechan |
Posted by MTIt's a screen mode number. On the SNES, various screen modes allow different amounts of backgrounds and color depths per background. Mode 7 specifically is the only one that allows affine transformation at the cost of flexibility, though you wouldn't think so when you can just switch modes mid-frame. https://www.youtube.com/watch?v=5SBEAZIfDAg https://www.youtube.com/watch?v=3FVN_Ze7bzw It's such a typical effect that any game with a flat map projected into perspective like Super Mario Kart and F-Zero do, no matter what system the games run on, it's still called "Mode 7", even if that's a completely different video mode on that system. For example, Wacky Wheels has a "mode 7 effect" (being a kart racer), even though on a PC, mode 7 isn't even graphical. |
MT | Sorry if this was already asked and answered somewhere, but what does the 7 digit mean in the mode title? Thanks. |
Near |
On the track-select screen, I can switch between resolutions and toggle "Perspective correction" with impunity. Once I reach the actual time trial, I can still switch resolutions but the moment I touch "toggle perspective", boom! Very strange. I'll look into it, thanks. with DerKoun's beta 3 in Mario Kart the internal resolution (if that makes sense) is now different on the track than it is on the title screen and menus. That one was my change. It's the same way hires and interlace modes work, the output resolution is the smallest size that will fit the game content. This is a fairly important speedup (outputting 4K pixels in *software* is going to be intensely painful even without any emulation at all), and it's also necessary to output at 256x240 for most shaders to work. It does look bad when changing modes, but the alternative is relegating 90% of hunterk's quark shader repository to non-working status. If we were willing to kill all but the OpenGL driver (which lacks exclusive mode support), I could include an option to upscale the video to a set size using point sampling, then apply shaders to output the final image. Shaders themselves could also be updated to be given hints as to the underlying resolution as well, but every single one would have to be updated. Ugh. I went back to look at the bilinear filtering, and it's just not good. I won't be doing that. Ah, darn =( Well, this is just a gimmick after all. It also can't really work with mode 7 mosaic by design, and the 3D perspective correction option is hit-or-miss depending on the game. Makes for some amazing screenshots, though. |
BearOso |
Posted by BearOso Ugh. I went back to look at the bilinear filtering, and it's just not good. I won't be doing that. |
MamiyaOtaru |
with DerKoun's beta 3 in Mario Kart the internal resolution (if that makes sense) is now different on the track than it is on the title screen and menus. So Hyllian's Super-xbr-3d (meant to smooth 2d elements like sprites while ignoring a 3d background) works on the track (see my screenshots earlier on page 2) but makes the menus garbled. Conversely regular shaders like scalefx work in the menus but not on the track. In the initial beta the menus were at the same internal resolution, and super-xbr-3d could handle the whole game. tl;dr internal resolution increases when mode7 is in use but not otherwise, but this confuses shaders. Could it stay consistent? Allows for http://chattypics.com/files/superxbr_v6ho1f2s4w.png |
nyanpasu64 |
Posted by BearOsoThat may fail to detect that soccer game, since it goes from zero distortion to nonzero, without a strict sign change? IDK |
BearOso |
Posted by byuu I'd just check if any of the parameters of the normal change sign. You create a new interpolation point on that scanline.
Snes9x could turn off the PPU and DSP output and run ahead to fetch all the parameters needed then warp back to the first scanline. The extra CPU cost would easily be dwarfed by the overhead of the extra rendering. However, I'm personally not up for the challenge at the moment. Bilinear filtering looks particularly easy to bring back, so I might start with that. |
Screwtape |
I got it to crash. Steps to reproduce: - Boot Super Mario Kart - Start a 1P time trial as Mario, on Mario Circuit 1 - when Lakitu shows with the traffic light, open Emulation settings, turn the scale from 240p up to 480p and untick "Perspective correction" Backtrace:
On the track-select screen, I can switch between resolutions and toggle "Perspective correction" with impunity. Once I reach the actual time trial, I can still switch resolutions but the moment I touch "toggle perspective", boom! > I think the perspective option can be enhanced in the future to detect when a frame isn't really in perspective, and to disable the option for said frames. Could even design it to split the frame into multiple chunks, so eg Terranigma can be made to look good. Probably won't be trivial, though. Certainly it's above my head, mathematically. How about using a moving average of the parameters to detect perspective changes? - from the third to the last scanline, extrapolate from the previous two scanlines to predict the current scanline - if the predicted value of any parameter is (configurable threshold) different from the recorded value, this scanline is the beginning of a new chunk - once the screen is divided into chunks, treat each chunk like the current code treats the whole screen - for interpolated scanlines between chunks, you could just leave them black, or use the extrapolated values from the previous two scanlines, or just treat that as a very tiny chunk and interpolate between the previous and next scanlines. You don't want to make the threshold too small, or you'll reproduce the rounding errors of the original hardware too closely. You don't want to make the threshold too large, or a "curved" effect like Terranimga would wind up broken into straight segments. Hopefully there's some sensible value that works acceptably well for all games. EDIT: /u/geearf on Reddit points out that the bsnes makefile has copied higan's "do not run make install as root" message, but (unlike higan) bsnes does not actually have any writable resources, so it should be fine to "make install" as root. |
Near |
I implemented DerKoun's work, and I understand it now. By default it just interpolates between two real scanlines nearest to the virtual scanline being output. The perspective option instead scans up and down the frame to find the first and last mode 7 scanline, and takes the matrix transform parameters from there. So yeah, HDMA effects that do something other than a standard affine-style transformation won't work, but most games do that so it's usually fine. I think the perspective option can be enhanced in the future to detect when a frame isn't really in perspective, and to disable the option for said frames. Could even design it to split the frame into multiple chunks, so eg Terranigma can be made to look good. Probably won't be trivial, though. Certainly it's above my head, mathematically. Also, upon implementing this, I can see that unfortunately this will be a nightmare for other emulators to implement, especially for FPGAs. The only reason this is possible is because of my new parallel PPU renderer that builds up an entire frame worth of scanlines (I/O registers and palette RAM.) If you don't implement this, you won't be able to do the critically important perspective correction. You can probably manage the non-perspective variant by averaging between the current and previous scanline mode 7 parameters, though. Then it's just a matter of some gruesome code to scale up mixed-mode backgrounds and sprites to your larger canvas. |
Screwtape | Somebody in the Reddit thread posted screenshots of Super Soccer, which happens to be another good example of what the Assume 3D Perspective option does. |
Screwtape |
Posted by hunterk There's a slider so you can pick your output resolution: 1× (disabled), 2× (480p), 3× (720p), 4× (960p). It defaults to 960p. |
Kawaoneechan | Oof that's painful. |
nyanpasu64 |
Posted by sureanem works for me, including in private browsing mode. I've uploaded to Dropbox too: https://www.dropbox.com/s/ywuctnjoyxu7ujo/magnifier-xbr4.png https://www.dropbox.com/s/eg54tt6z7c53ivn/magnifier-xbrz4.png |