Previous Thread
Next Thread
Print Thread
Page 24 of 120 1 2 22 23 24 25 26 119 120
Joined: Apr 2004
Posts: 1,563
Likes: 12
J
Very Senior Member
Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,563
Likes: 12
This would be so much nicer with waitstate support in the core ...

Kale #52814 08/17/09 07:20 PM
Joined: Dec 2005
Posts: 330
A
AWJ Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2005
Posts: 330
Originally Posted by Kale
Could also be that calling a single line of mode 5 makes the entire screen to be 512x224, but again we are into the same theory league as who shot JFK...

I'm sorry, but this talk about the resolution of "the entire screen" shows that you don't seem to grok how a CRTC or for that matter a raster display works. A CRT only has a discrete "resolution" in the Y axis--the number of visible scanlines. The X "resolution" is merely a question of how rapidly the analog signal feeding the CRT changes, and there's absolutely no reason that frequency has to be the same on each scanline. You could theoretically make a CRTC that produced a 320-pixel horizontal resolution in the top half of the display, a 256-pixel horizontal resolution on odd-numbered scanlines in the bottom half, and an 800-pixel horizontal resolution on even-numbered scanlines in the bottom half. Of course this hypothetical CRTC would have no practical use whatsoever, but it would work perfectly fine with any standard unmodified CRT.

Of course, an emulator has to ultimately produce a rectangular image with a discrete resolution in both axes. When the emulated CRTC output has different resolutions on different scanlines, the only way you can do this while preserving all the horizontal detail is by upscaling every scanline to the highest horizontal resolution that's present in the frame. The only other possibility is to downscale the higher-resolution scanlines to the lower resolution. That's what your SD3 screenshot is doing, and it's not correct emulation--it's throwing away image detail that would be visible on real hardware.

Someone (Arbee? Aaron?) help me out here, I'm not sure if I'm getting through...

Last edited by AWJ; 08/17/09 07:20 PM.
AWJ #52815 08/17/09 08:12 PM
Joined: Mar 2001
Posts: 17,217
Likes: 234
R
Very Senior Member
Offline
Very Senior Member
R
Joined: Mar 2001
Posts: 17,217
Likes: 234
byuu mentioned that 512 mode double-pumps the DAC - I assume that means the pixel clock goes faster for those lines so you have twice as many pixels per master cycle.

ETA: Alternatively the pixel clock is always fast enough for 512 but they normally feed each pixel twice. Either way we know it doesn't impact the actual H or Vsync timing or else the screen wouldn't sync when you did a split like that.

Last edited by R. Belmont; 08/17/09 08:15 PM.
Joined: Jun 2008
Posts: 205
B
Senior Member
Offline
Senior Member
B
Joined: Jun 2008
Posts: 205
I always like to show this picture to emu devs:
http://img35.imageshack.us/img35/3281/hires.png

That's Jurassic Park, it uses pseudo-hires. On the left is what the image looks like on a TV. On the right is an emulator that doesn't support pseudo-hires. The bottom image shows how pseudo-hires works. You'll notice even columns are one background layer, and odd columns are another.

The important thing to take away is that the pixels at 512-width aren't as sharp as pixels at 256-width: they tend to blur with their neighbors. It's because the TV has less time to display them, and CRT fuzziness, and bla bla bla.

Note that even with the blending, you will still need to render the output at 512-width. Merging even and odd pixels at 50% will lose too much detail.

Also note, something no other emulator does for some reason, but I hope you guys will: hires and pseudo-hires, though they grab pixels differently, output exactly the same. Thusly, you should perform the same blurring when you render true hires screens like in Secret of Mana 2. Yes, it will make text slightly harder to read. But there's nothing stopping a real system from using pseudo-hires to display text, or real hires to blend two screens ala Jurassic Park. A real SNES won't magically output clearer pixels in true hires mode.

This is how I output 512-width lines and blend them to create the top-left image. It averages the next pixel to output with the previous pixel, then saves the true current pixel for the next loop iteration. Feel free to use something similar, or not.

Code
      for(unsigned x = 0, prev = 0; x < 256; x++) {
        curr = get_pixel_swap(x);
        *ptr++ = (prev + curr - ((prev ^ curr) & 0x0421)) >> 1;
        prev = curr;

        curr = get_pixel_normal(x);
        *ptr++ = (prev + curr - ((prev ^ curr) & 0x0421)) >> 1;
        prev = curr;
      }

Credit to blargg for the idea.

byuu #52817 08/17/09 09:26 PM
Joined: Dec 2005
Posts: 330
A
AWJ Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2005
Posts: 330
Originally Posted by byuu
This is how I output 512-width lines and blend them to create the top-left image. It averages the next pixel to output with the previous pixel, then saves the true current pixel for the next loop iteration. Feel free to use something similar, or not.

A side effect of applying a lowpass filter to the entire screen (which is what you're doing) is that the parts of the screen that are fake-blended using pseudo-hires appear sharper than the unblended parts. Look at the fence posts near the left and right edges--the part of the post that's "behind" the text window has pixel-sharp edges, while the part that isn't is blurred.

ETA: the difference between the flames in the blended and non-blended parts of the upper left screenshot is even more obvious.

Also, it would be nice if you posted a screenshot of SD3 under your renderer for comparison.

Last edited by AWJ; 08/17/09 09:44 PM.
byuu #52818 08/17/09 09:45 PM
Joined: Aug 2009
Posts: 1,251
Likes: 171
Kale Offline OP
Very Senior Member
OP Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,251
Likes: 171
r5455 /src/mame/machine/snes.c: [SNES]: Made the gfx mode switches more accurate.


I was right on one thing: we definitely have a bug with gfx mode 5/6 (see the vertical stripes). So I declare it a draw! laugh

[Linked Image from mamedev.emulab.it]

AWJ #52819 08/17/09 09:47 PM
Joined: Jun 2008
Posts: 205
B
Senior Member
Offline
Senior Member
B
Joined: Jun 2008
Posts: 205
Yeah, because it's aliasing with the popup window. Perhaps there's a better algorithm for the blending than what I used. The entire screen is actually rendered at 512-width, that's not a 50/50 split like the textboxes in Secret of Mana 2. It's just that most of the pixels outside of that window are the same on even and odd columns.

The same aliasing may occur on a TV, I'd have to look and see.

EDIT: AWJ, here's Secret of Mana 2. Note the flowers at the bottom. http://img11.imageshack.us/img11/374/sd3e.png

Last edited by byuu; 08/17/09 09:50 PM.
byuu #52821 08/17/09 10:13 PM
Joined: Dec 2005
Posts: 330
A
AWJ Offline
Senior Member
Offline
Senior Member
A
Joined: Dec 2005
Posts: 330
Originally Posted by byuu
Yeah, because it's aliasing with the popup window. Perhaps there's a better algorithm for the blending than what I used. The entire screen is actually rendered at 512-width, that's not a 50/50 split like the textboxes in Secret of Mana 2. It's just that most of the pixels outside of that window are the same on even and odd columns.

The same aliasing may occur on a TV, I'd have to look and see.

EDIT: AWJ, here's Secret of Mana 2. Note the flowers at the bottom. http://img11.imageshack.us/img11/374/sd3e.png

Wow, the lowpass filter makes SD3's background look much nicer! Especially the grass. The font is also a lot less blurry than I expected.

I don't think it's possible to fix the aliasing (as you call it) in JP without making all the games that use hires "normally" look worse. JP is pretty much the only game that abuses hires for faux-alpha-blending (rather than to get more detail for fonts, etc.), isn't it? I wonder why they didn't just use color math...

AWJ #52823 08/17/09 10:23 PM
Joined: Aug 2009
Posts: 1,251
Likes: 171
Kale Offline OP
Very Senior Member
OP Offline
Very Senior Member
Joined: Aug 2009
Posts: 1,251
Likes: 171
Something started to work with the latest change...

[Linked Image from mamedev.emulab.it]



[Linked Image from mamedev.emulab.it]

[Linked Image from mamedev.emulab.it]

...I wonder if anything broke actually...

Kale #52825 08/17/09 10:34 PM
Joined: Dec 1999
Posts: 1,180
Likes: 2
J
Very Senior Member
Offline
Very Senior Member
J
Joined: Dec 1999
Posts: 1,180
Likes: 2
Note that the MESS video code for SNES is shared with MAME for NSS so we can't go adding TV-specific blending effects willy-nilly without also handling the arcade monitor case.

Page 24 of 120 1 2 22 23 24 25 26 119 120

Link Copied to Clipboard
Who's Online Now
1 members (Dodg), 321 guests, and 4 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics9,320
Posts121,944
Members5,074
Most Online1,283
Dec 21st, 2022
Our Sponsor
These forums are sponsored by Superior Solitaire, an ad-free card game collection for macOS and iOS. Download it today!

Superior Solitaire
Forum hosted by www.retrogamesformac.com