SNES NTSC Composite Video Filter

Strictly for discussing ZSNES development and for submitting code. You can also join us on IRC at irc.libera.chat in #zsnes.
Please, no requests here.

Moderator: ZSNES Mods

Post Reply
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

Verdauga Greeneyes wrote:Blargg, do you currently have plans for a PAL filter (that would also work on 60 Hz), given that you can gather enough information? I'm sure all us PAL people would really appreciate that. (I know I would!)
i might be able to help out. if you need any help, i got pal snes and nes

and i got a tv card, just have to find my RF cable, i am unable to use the nes or snes composit cables on my tv card, im unsure if i even still have the composit nes... i should really call it a secam nes i guess... doesnt really matter as secam is pal with a dot-crawl fix
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Bahamut_ZERO_939 wrote:I see the issue also in Mode7 as well as the high-res modes. I noticed this with not only Lufia 2 but other Mode7 games as well.
I believe Lufia 2 only uses Hires for the endgame credits.

HQx modes work fine under Mode 7. However, they are not applied when hires Mode7 is checked in the Video options.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Clements
Randomness
Posts: 1172
Joined: Wed Jul 28, 2004 4:01 pm
Location: UK
Contact:

Post by Clements »

HqXx filters do not filter non-high res Mode7 like the bilinear mode7 filter option in Snes9x though. The bilinear mode7 filter is able to eliminate aliasing in the Nintendo logo when it zooms around the screen in Killer Instinct for example, whereas hqXx does not affect it at all (so the edges appear like blocky pixels):

Snes9x with bilinear mode7 on + 2xSAI:

Image

ZSNES with hqXx (same result with bsnes too):

Image

It is as if the bilinear mode7 filter is acting like a basic version of anisotropic filtering, filtering the plane, rather than just filtering the screen as you would see it in 2D.
Bahamut_ZERO_Clue

Post by Bahamut_ZERO_Clue »

Why doesn't any of the current filters effect Mode7? You would figure it would or it probably does but because the drawing method is different it doesn't affect it as much. Quite possibly maybe extending the current filters to affect Mode7 would be a good idea.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Bahamut_ZERO_939 wrote:Why doesn't any of the current filters effect Mode7? You would figure it would or it probably does but because the drawing method is different it doesn't affect it as much. Quite possibly maybe extending the current filters to affect Mode7 would be a good idea.
The filters do affect Mode 7, just not when the Hires Mode 7 option is enabled.

Give me a moment to double check this.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Edit: Whoops, my bad

No filtering is applied to any hires image. Filters are applied to Mode 7 though.

Let's put it this way. Final Fantasy 2/4, 5, 3/6 all use Mode 7 on the overworld screen, but not hires. The filters works then. Seiken Densetsu 3 uses hires for the text while shopping or the text when you've cleared all the enemies on the screen. The screen becomes totally unfiltered under that condition.

I might post examples to explain it better.
Last edited by Deathlike2 on Fri Mar 17, 2006 3:10 am, edited 4 times in total.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

KI's intro isn't hires. The mode7 screen is filtered as usual.

Clements is right, Snes9x' mode7 filtering feature is nice.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

grinvader wrote:KI's intro isn't hires. The mode7 screen is filtered as usual.
For a moment, I thought it was the DKC one (that one is hires I think). My bad.
Clements is right, Snes9x' mode7 filtering feature is nice.
Yes it is.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Deathlike2 wrote:
grinvader wrote:KI's intro isn't hires. The mode7 screen is filtered as usual.
For a moment, I thought it was the DKC one (that one is hires I think). My bad.
The DKC (1, 2 and 3) intros aren't hires. Moreover, they never zoom on the Nintendo logo like shown in Clements' pic.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
blackmyst
Zealot
Posts: 1161
Joined: Sun Sep 26, 2004 8:36 pm
Location: Place.

Post by blackmyst »

grinvader wrote:
Deathlike2 wrote:
grinvader wrote:KI's intro isn't hires. The mode7 screen is filtered as usual.
For a moment, I thought it was the DKC one (that one is hires I think). My bad.
The DKC (1, 2 and 3) intros aren't hires. Moreover, they never zoom on the Nintendo logo like shown in Clements' pic.
Though in both DKC1 and 2, the rare logo is rendered in double horizontal resolution when it has zoomed out into the bottom right corner. Don't know how much of the screen area this affects, but yeah.
[size=75][b]Procrastination.[/b]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

grinvader wrote:
Deathlike2 wrote:
grinvader wrote:KI's intro isn't hires. The mode7 screen is filtered as usual.
For a moment, I thought it was the DKC one (that one is hires I think). My bad.
The DKC (1, 2 and 3) intros aren't hires. Moreover, they never zoom on the Nintendo logo like shown in Clements' pic.
I just meant the Nintendo presents part of the DKC1 intro.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

About PAL SNES and PAL SNES TV output:

1. PAL TVs don't have horizontal scanlines at all,but the PAL SNES outputs video WITH scanlines .On some TVs (older ones) they're barely noticeable (like 25% or less scanlines intensity selected in emulator),on some newer ones (that support PAL60),they are very noticeable (like 75% scanline intensity).
When you look at a PAL screen closely with a black screen (no input signal,AV mode selected),at first you see no horizontal scanlines at all.If you look really carefully,you can see the even or odd vertical lines for a brief period.These are so well "threaded" you don't notice those vertical lines at all. It takes a good training to be able to see them,and that is from a very small distance you'll screw your eyes if you look at the CRT like this. If you look even more carefully,you can even see how the lines are very slowly moving upwards.I think this is what makes the picture so solid and no vertical lines visible at all.
But,when you plug a SNES to a PAL TV,you'll notice scanlines,now CLEARLY visible all the time,and they are rock-solid,no "moving upwards effect" now.And on some TVs,like a not-that-big Samsung 21",for example,those can be very distinguishable,almost like the NTSC ones.
These kinds of TVs that output high-resolution (640x480 and up) video sources much clearer than a >20-year-old '84 TV,on the other hand reveal A LOT of defects with low-res sources (320x240 and lower) and you can see the scanlines,the "sloped lines pollution" PAL SNES defect and even the "center- vertical pillar screen burn" (do you know of this one?) that happens to your TV after several months of playing.
2. All PAL SNES games are viewed in 16:9 letterboxed mode on 4:3 PAL TVs,so they have thick black borders above and below the SNES video display.The PAL SNES filter must output video in 16:9 mode on a 4:3 ratio screen to provide accurate display.ZSNES does not run PAL roms with borders.I really miss the black PAL borders.As a nice side-effect,PAL borders squash the screen so vertical scanlines appear thinner than NTSC ones and are more tolerable.I hate messing with the monitor's size controls and measuring the ratio with a ruler just to get this kind of effect.Then,the desktop at this resolution setting becomes unusable after exiting ZSNES.
3. PAL TVs have thin vertical RGB stripes and a cell mesh when you look very close at the CRT.
4. PAL SNES output (Composite and RF) exhibit a vertical defect most noticeable on thick white vertical lines / sprites and the big time display numbers on Street Fighter II.The PAL SNES cannot display a perfect vertical line. It adds many sloping lines at a something like a 20-degree angle to the vertical line(s) polluting them with this "noise". It's always there and it doesn't move/change/disappear. It doesn't appear when scrolling,it is there all the time.
It is noticeable mostly in slender vertical objects/lines/sprites with colors along the "hot" side of the spectrum and white.Barely noticeable or not at all with colors on the "cold" side of the spectrum or darker colors.
5. TVs usually don't have "perfect" convergence like monitors (especially LCDs).It's always a bit or even more "off".If you wanna simulate an analog TV on an LCD screen,this defect should be included too.
There's also the color bleeding and dot crawl...


blargg,your NTSC filter performs really good with the latest version of NEStopia.I noticed a massive speed improvement over the previous version.It's so fast,I can run it in 2048x1536 now without any slowdown,before I was struggling to get it working at 60fps at 640x480 :) Weird.
I don't know what the developer of NEStopia has done,but I can now run NEStopia with HQxX with VSync at 2048x1536 and get amazing 100-120 fps ! (no FPS limit)
Really weird.Was the HQxX filter also optimized by you,blargg?
(and all this on a 2 1/2-year old AXP2600+ with 1GB RAM)
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Deathlike2 wrote:I just meant the Nintendo presents part of the DKC1 intro.
So was I. It's not used on a Mode7 surface. It's not hires either.
皆黙って俺について来い!!

Code: Select all

<jmr> bsnes has the most accurate wiki page but it takes forever to load (or something)
Pantheon: Gideon Zhi | CaitSith2 | Nach | kode54
blackmyst
Zealot
Posts: 1161
Joined: Sun Sep 26, 2004 8:36 pm
Location: Place.

Post by blackmyst »

kick wrote:2. All PAL SNES games are viewed in 16:9 letterboxed mode on 4:3 PAL TVs,so they have thick black borders above and below the SNES video display.The PAL SNES filter must output video in 16:9 mode on a 4:3 ratio screen to provide accurate display.ZSNES does not run PAL roms with borders.I really miss the black PAL borders.As a nice side-effect,PAL borders squash the screen so vertical scanlines appear thinner than NTSC ones and are more tolerable.I hate messing with the monitor's size controls and measuring the ratio with a ruler just to get this kind of effect.Then,the desktop at this resolution setting becomes unusable after exiting ZSNES.
No, some PAL games are properly converted and take advantage of the extra resolution. Super Mario Allstars would be an example. Though even then, the individual tiles remain looking somewhat squashed. But I suppose they can't very well be expected to redraw every single graphic in the game.

And actually, for those "lazy" ports that just output NTSC resolution on a PAL screen, that would be 8:5, not 16:9. This is not "accurate display", it's just something that happens when you're too lazy to modify your game to at least cover the extra lines.
[size=75][b]Procrastination.[/b]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
kick
Trooper
Posts: 550
Joined: Wed Mar 01, 2006 8:47 pm

Post by kick »

Hmmm...it may be 16:9,cause my TV is one of those "extended res ones" so it displays them in 16:9 instead.I've measured the resulting display on the TV and it's *exactly* 16:9 (1.7777777 x 1)

It's probably because those 256 pixels are stretched to 320 for NTSC
byuu

Post by byuu »

You do realize that by adding those extra 15 lines, you a) have to transfer more graphics to update the screen and b) have less time to do it, right?

262-(239+1)=22*1324=29128/8=3641 bytes can be transferred to VRAM per frame
262-(224+1)=37*1324=48988/8=6123.5 bytes

256*224=57344 bytes displayed/frame
256*239=61184 bytes displayed/frame
And of course there's four BG layers and the sprite layer on that.

Not to mention the overhead of the code in the actual NMI routine or whatever.
blackmyst
Zealot
Posts: 1161
Joined: Sun Sep 26, 2004 8:36 pm
Location: Place.

Post by blackmyst »

kick wrote:Hmmm...it may be 16:9,cause my TV is one of those "extended res ones" so it displays them in 16:9 instead.I've measured the resulting display on the TV and it's *exactly* 16:9 (1.7777777 x 1)

It's probably because those 256 pixels are stretched to 320 for NTSC
That's horrible, that's even worse than regular pal. :0 Have you let some younger sibling fiddle with the stretch settings or something?

Also, I don't know what you mean by stretched to 320. Did you think that was the TV's horizontal resolution? Whatever the case, 16:9 is not how it's supposed to be.

byuu wrote:You do realize that by adding those extra 15 lines, you a) have to transfer more graphics to update the screen and b) have less time to do it, right?

262-(239+1)=22*1324=29128/8=3641 bytes can be transferred to VRAM per frame
262-(224+1)=37*1324=48988/8=6123.5 bytes

256*224=57344 bytes displayed/frame
256*239=61184 bytes displayed/frame
And of course there's four BG layers and the sprite layer on that.

Not to mention the overhead of the code in the actual NMI routine or whatever.
Were you replying to me? Well, I won't pretend to know anything about that, but Mario Allstars and Killer Instinct are two examples of games that seem to handle it just fine. Either way, the point was that it's at least possible in some cases to use the whole screen and the black bars aren't something that's neccesarily forced on all PAL games.
[size=75][b]Procrastination.[/b]
Hard Work Often Pays Off After Time, but Laziness Always Pays Off Now.[/size]
ICEknight
Rookie
Posts: 33
Joined: Sun Mar 12, 2006 7:15 pm

Post by ICEknight »

kick wrote:On some TVs (older ones) they're barely noticeable (like 25% or less scanlines intensity selected in emulator),on some newer ones (that support PAL60),they are very noticeable (like 75% scanline intensity).
[...]
But,when you plug a SNES to a PAL TV,you'll notice scanlines,now CLEARLY visible all the time,and they are rock-solid
It would be nice if you could provide screens of this, as I've done to back up my statements about the complete lack of visible scanlines on all the PAL TVs I've been able to check.

It wasn't like 25% or anything, they were just not visible at all due to the way the RGB cells are organized, which makes it impossible for any scanlines to appear (at least when plugging in a MegaDrive or a NES, which are the systems I've tried).
paulguy
Zealot
Posts: 1076
Joined: Sat Jul 02, 2005 2:01 am
Contact:

Post by paulguy »

so, does this work on linux? i compiled the latest wip as of today and the checkbox does nothing. i tried loading a game and restarting zsnes then loading a game and still nothing. i tried a few resolutions: 1280x1024 ODS FULL, 512x448 DR FULL, 1024x896 ODR WIN and 640x480 ODS FULL (my usual res) and none of these worked, either.
ICEknight
Rookie
Posts: 33
Joined: Sun Mar 12, 2006 7:15 pm

Post by ICEknight »

blargg wrote:
b)-Filter that shows the signal as it comes from the real console (so it would look like the previous filter when the PC video signal is being output through a real TV).
That wouldn't be very hard to code but it would require a way to output a ~14.32 MHz raw signal from a video card (i.e. like an 8-bit sound card with a 14.32 MHz sampling rate). This would be simpler than the full NTSC filter since it's only doing the first half of the operation. I even wrote something like this for the NES video signal but I did't have any way to actually output it from my PC to a TV. Since the only composite video output you can easily get is from a TV card, it's more difficult becuase the TV card itself has its own encoding characteristics, and cards probably differ somewhat.
Seeing as how this is being ported to the emus for Xbox, this b) option could be also used for them, not only for PCs with a TV-out. I don't know if the X-Box can send a signal with such frequency, but at least it will indeed play it fullscreen.

So only the a) option (PC-monitor version) would have to additionally simulate the TV stuff such as scanlines.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

im pretty sure the filter isnt implemented yet... but from the looks of the ntsc filter options (cvs) it looks like its gonna be an awesome filter.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

It is now implemented in CVS with all options of the filter configurably on the fly. Although it doesn't exactly fit nicely in fullscreen mode so I will have work on that. Perhaps adding a native 600x446 resolution would be best for this.
franpa
Gecko snack
Posts: 2374
Joined: Sun Aug 21, 2005 11:06 am
Location: Australia, QLD
Contact:

Post by franpa »

it doesnt work... i see the extra options but they have no effect on anything at all.
Core i7 920 @ 2.66GHZ | ASUS P6T Motherboard | 8GB DDR3 1600 RAM | Gigabyte Geforce 760 4GB | Windows 10 Pro x64
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

CVS updates take some time for whatever the reason. Wait a couple of hours and then the new code can be downloaded for compilation...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

Moral of the story: don't add UI elements until they actually do something.
Post Reply