Accurate(ish) CRT TV simulation theory

Archived bsnes development news, feature requests and bug reports. Forum is now located at http://board.byuu.org/
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

creaothceann wrote:
tetsuo55 wrote:I think we can all agree that the CRT-TV's the snes was designed for was completely unable to display a progressive signal.

although the snes internally computes a certain height the full signal will eventually be 525 lines high. Unlike interlaced both frames simply display the same image.(effictively creating a 30 fps progressive image on a 60fps screen by line doubling)
Let's recap:

The TV draws 525 lines interlaced in two passes at 60 fields per second / 30 frames per second. The signal source is responsible for shifting every other field.

The SNES doesn't shift the fields in "progressive mode", so we get a 60 Hz progressive image with 525 / 2 visible lines, and black scanlines between them. In "interlaced mode" the SNES includes the shifting signals, so we get a 30 Hz interlaced image with 525 visible lines and no (or less pronounced) scanlines.

Aspect ratio can be safely assumed to be 4:3. Let's drop that already.
That sounds very plausible

Again confirming that the picture height is 486..

We are not discussing the 4:3 picture aspect ratio but the 1.16.... pixel aspect ratio
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

Here are some artist renderings using the latest data.
First we see the image as the snes is sending it in the broadcast signal, it looks like this on every frame, its not sending the interlace sync so the same scanlines are used over and over

Snes Output
Image

Here we can cleary see that this results in scanlines(this example would be of a perfect tv because most tv's would bleed some light from the scanline above and below into the black scanline making it less pronounced)

This is what the TV is showing (no aspect ratio correction applied yet)
Image

And here it is with the correct pixel aspect correction based on the fact that the image is twice as high on the actual screen as opposed to the ntsc signal.(there is a rounding error, thats why the image is not 640 wide)

And this is what it looks like with the aspect ratio applied
Image

We're still missing a lot, here's a short list:

-Overscan -5 to +5
-Kel factor 0-30% (bilinear filtering)
-Scanlines: bleed 50% top scanline 50% bottom scanline settable between 0-100 (0 being black)

Gamma correction is probably needed too

EDIT:

Anyone else think the last picture looks very convincing? after a while i hardly notice the black scanlines anymore, it already looks like the other scanlines are bigger.
Last edited by tetsuo55 on Fri Aug 29, 2008 6:53 pm, edited 1 time in total.
FirebrandX
Trooper
Posts: 376
Joined: Tue Apr 19, 2005 11:08 pm
Location: DFW area, TX USA
Contact:

Post by FirebrandX »

Seeing as how some TVs were better than others (3D comb filter, s-video support, etc.) I'd say be sure not to go overboard with effects that mimic color bleed and so forth. You might as well add a filter for dusty screen with finger prints if you're wanting to go the whole 9 ;-)
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

Yeah i agree.

I'm going to stick to the 3 i mentioned above.

Overscan
Kell factor
scanlines

Simply because every tv had these by design and these influenced the image most
Last edited by tetsuo55 on Fri Aug 29, 2008 6:52 pm, edited 1 time in total.
creaothceann
Seen it all
Posts: 2302
Joined: Mon Jan 03, 2005 5:04 pm
Location: Germany
Contact:

Post by creaothceann »

I think you mean the Kell factor.
vSNES | Delphi 10 BPLs
bsnes launcher with recent files list
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

creaothceann wrote:I think you mean the Kell factor.
Thanks i corrected it.

I started reading some more and it seems very interesting to accurately simulate this effect.

I will run some tests

If i can get this right we'll have the scanline bleeding for free :D
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

tetsuo55 wrote:after a while i hardly notice the black scanlines anymore, it already looks like the other scanlines are bigger.
Brain feature (congrats, you have a functionnal visual cortex).
皆黙って俺について来い!!

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
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

grinvader wrote:
tetsuo55 wrote:after a while i hardly notice the black scanlines anymore, it already looks like the other scanlines are bigger.
Brain feature (congrats, you have a functionnal visual cortex).
Thanks! 8)
Gil_Hamilton
Buzzkill Gil
Posts: 4294
Joined: Wed Jan 12, 2005 7:14 pm

Post by Gil_Hamilton »

tetsuo55 wrote:
creaothceann wrote:
tetsuo55 wrote:I think we can all agree that the CRT-TV's the snes was designed for was completely unable to display a progressive signal.

although the snes internally computes a certain height the full signal will eventually be 525 lines high. Unlike interlaced both frames simply display the same image.(effictively creating a 30 fps progressive image on a 60fps screen by line doubling)
Let's recap:

The TV draws 525 lines interlaced in two passes at 60 fields per second / 30 frames per second. The signal source is responsible for shifting every other field.

The SNES doesn't shift the fields in "progressive mode", so we get a 60 Hz progressive image with 525 / 2 visible lines, and black scanlines between them. In "interlaced mode" the SNES includes the shifting signals, so we get a 30 Hz interlaced image with 525 visible lines and no (or less pronounced) scanlines.

Aspect ratio can be safely assumed to be 4:3. Let's drop that already.
That sounds very plausible

Again confirming that the picture height is 486..

We are not discussing the 4:3 picture aspect ratio but the 1.16.... pixel aspect ratio
tetsuo55 wrote:
Gil_Hamilton wrote: Except that scan position is controlled by the system.
As I understand things, ye olde systems muck with the timing signal to get the same set of scanlines drawn twice. It confuses the hell out of modern panel TVs, but works GREAT on CRTs.

And you may notice that the dark scanlines disappear(or at least shrink) when the system is in "high-res" mode. Because it's now drawing picture inside the black lines.
The result is the same, the image is twice as high

the question is how does it work exactly?
I like how you respond to posts detailing why you're totally and 100% wrong with a brief inanity about how it confirms you're right.
You clearly either didn't read what was said, or chose to ignore it.

525/2=262.5, but you don't get a half scanline. If you accept what creaothceann posted, you must accept that the SNES outputs a 60FPS image that's less than 486 lines tall(in fact, it's 224 lines tall).
Odd and even frames on a real TV have differing scanline counts. To make sure the scan is interlaced, actually. If they have the same number of lines, TVs would tend to drop them on the same set of lines, giving you a half-resolution progressive signal.
Fact: The original NTSC development committee KNEW that their standard was easily forced into progressive scan, and that TVs would merrily plow ahead that way.
Certainly hardware has changed since then, but the fundamental behavior of a CRT TV now isn't a lot different than it was then.


The TV DOES NOT draw all the scanlines all the time. It only draws enough lines to get the resolution the source is trying for. If it DID draw all the lines, the signal would be in proper NTSC spec, and work just as well as a fancy-pants PS2 video feed on a panel TV.

There is, in fact, a good bit of dis-satisfaction among a certain segment of the market about the fact that modern ports of older games use 480i instead of the so-called 240p, which all but eliminates scanlines from the image(and creates a few artifacts).
Under your flawed hypothesis, they're ALL 480i, so there's no difference. But the difference IS there, and IS visible.
http://scanlines.hazard-city.de/ has some decent samples of the difference.

Another test: Go fire up something with a reasonably fast horizontal scroll. Now look for the fringing that occurs on horizontal scrolls because both sets of scanlines are at different locations. You won't see it. Because the second set of scanlines isn't illuminated.

And again, I ask you to check some actual software, such as Secret of Mana, that uses the "high-res" mode. The introduction of the second scanline set is highly visible, both in terms of scanline reduction and in terms of the flicker introduced.



But what do I know? I'm clearly a complete buffoon, since I don't understand that NTSC = DVD. And I subscribe tot he silly belief that the NTSC spec placed the scan controls within the video signal, making it very easy to convince a TV to display non-spec images.
blargg
Regular
Posts: 327
Joined: Thu Jun 30, 2005 1:54 pm
Location: USA
Contact:

Post by blargg »

tetsuo55 wrote:-The calculated aspect ratio cannot be right for both progressive and interlaced
-I cannot find anywhere that the thickness of a scanline can be adjusted by changing the signal (unless you use a multisync monitor which changes the vertical refreshrate)
The spacing between scanlines on each field is double the final spacing after two fields are combined, hence the name, INTERLACED. One field does even lines from the final frame, the other odd lines. So if you trick the display into showing only even or only odd fields every time, you get a progressive display with half the number of scanlines vertically as an interlaced frame. You get a true progressive display that can show totally smooth scrolling in any direction. That document you linked previous should covers this.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Gil_Hamilton wrote:such as Secret of Mana, that uses the "high-res" mode.
*cough* hires != interlace.

(sorry)
皆黙って俺について来い!!

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
Gil_Hamilton
Buzzkill Gil
Posts: 4294
Joined: Wed Jan 12, 2005 7:14 pm

Post by Gil_Hamilton »

grinvader wrote:
Gil_Hamilton wrote:such as Secret of Mana, that uses the "high-res" mode.
*cough* hires != interlace.

(sorry)
High-res in the sense of 400+ lines of resolution, which requires an interlaced image.

Though I admit to not remembering how the SNES video settings all connect.
grinvader
ZSNES Shake Shake Prinny
Posts: 5632
Joined: Wed Jul 28, 2004 4:15 pm
Location: PAL50, dood !

Post by grinvader »

Gil_Hamilton wrote:
grinvader wrote:
Gil_Hamilton wrote:such as Secret of Mana, that uses the "high-res" mode.
*cough* hires != interlace.

(sorry)
High-res in the sense of 400+ lines of resolution, which requires an interlaced image.

Though I admit to not remembering how the SNES video settings all connect.
Semantics, but for SNES "hires" is the upping of horizontal res to double, and "interlace" is the doubling of vertical res (while "overscan" adds more drawn lines before vblank)

Not that many popular games use interlace ingame, probably due to the low performance obtained with it. I remember Lufia 1 or 2's credits using it... and that silly female wrestling coach simulation game (which is what I usually test hires+interlace with).

Point was, SoM doesn't have interlace active.
皆黙って俺について来い!!

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
Gil_Hamilton
Buzzkill Gil
Posts: 4294
Joined: Wed Jan 12, 2005 7:14 pm

Post by Gil_Hamilton »

grinvader wrote:
Gil_Hamilton wrote:
grinvader wrote:
Gil_Hamilton wrote:such as Secret of Mana, that uses the "high-res" mode.
*cough* hires != interlace.

(sorry)
High-res in the sense of 400+ lines of resolution, which requires an interlaced image.

Though I admit to not remembering how the SNES video settings all connect.
Semantics, but for SNES "hires" is the upping of horizontal res to double, and "interlace" is the doubling of vertical res (while "overscan" adds more drawn lines before vblank)
Ah.
Not that many popular games use interlace ingame, probably due to the low performance obtained with it. I remember Lufia 1 or 2's credits using it... and that silly female wrestling coach simulation game (which is what I usually test hires+interlace with).

Point was, SoM doesn't have interlace active.
I know there's also scrolling artifacts with interlacing. That's not unique to the SNES, and it's part of why they standardized on the progressive hack for so long.

Weren't the SoM menu screens interlaced?

*boots it to check*

Nope. Guess not.
Never mind then. Don't use SoM to check interlaced mode.

Well, crap. I know a few PS1 games that interlace, but I'm not sure if they swap modes in-game. Wanted a clear and definite example where you can see the difference in a single game. :(
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

Gil_Hamilton wrote: http://scanlines.hazard-city.de/ has some decent samples of the difference.
Dude you offically ROCK. That link is what i have been looking for since the first day i started thinking about CRT simulation.

What i'm trying to say/do is EXACTLY what he is explaining(he's obviously explaining it better than i am)

Again this confirms what i'm trying to say, i guess we're just misunderstanding eachother.

blargg wrote:
tetsuo55 wrote:-The calculated aspect ratio cannot be right for both progressive and interlaced
-I cannot find anywhere that the thickness of a scanline can be adjusted by changing the signal (unless you use a multisync monitor which changes the vertical refreshrate)
The spacing between scanlines on each field is double the final spacing after two fields are combined, hence the name, INTERLACED. One field does even lines from the final frame, the other odd lines. So if you trick the display into showing only even or only odd fields every time, you get a progressive display with half the number of scanlines vertically as an interlaced frame. You get a true progressive display that can show totally smooth scrolling in any direction. That document you linked previous should covers this.
Yeah i completely understand that part, but i did not understand how the snes was achieving this. (how does the snes adjust the signal so each frame gets written to the same scanline set)


After reading up on the kell factor its now clear to me why the unrendered scanlines are thinner than you would expect, the brain does some tricks on top of that and the unrendered scanlines almost seem to dissapear (especially on pal systems)

EDIT:
Here's how i understand it works

According to this source:
http://digital.ni.com/public.nsf/websea ... enDocument

You can easiliy tell the tv if the next frame is going to be ODD or EVEN.

The snes displays all its frames on the ODD scanlines. It tells the TV to do so by adding a full scanline to the end of the signal. (a half scanline would tell the TV to jump to the EVEN field scanning)

This leads to black scanlines that are equaly as wide as the image scanlines.

This also means that on the 4:3 TV the vertical size of the image is effectively doubled.

---------

However when you look at gamescreen the scanlines appear to be a lot thinner than the image lines. this has 2 causes:

1. The kell factor, depending on your tv the image scanline could be bleeding out into the black scanline by as much as 15% on each vertical side. This reduces the width of the black scanline by 30%, the 70% left gets further reduced by an effect in the brain.



This also means that appart from the rouding error the last image i posted is correct for a TV with a kell factor of 1.0
dvdmth
New Member
Posts: 6
Joined: Thu Feb 14, 2008 9:12 pm

Post by dvdmth »

As I understand it, when the SNES is in interlace mode, the first field of each frame is 263 scanlines, while the second is 262 lines (525 total). When the SNES is in progressive mode, ALL fields are 262 scanlines long. For PAL, the numbers are 312/313 for interlace and 312 for progressive (V-Blank is longer on PAL than NTSC).
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

dvdmth wrote:As I understand it, when the SNES is in interlace mode, the first field of each frame is 263 scanlines, while the second is 262 lines (525 total). When the SNES is in progressive mode, ALL fields are 262 scanlines long. For PAL, the numbers are 312/313 for interlace and 312 for progressive (V-Blank is longer on PAL than NTSC).
Yeah that difference causes the TV to switch between ODD and EVEN frames.

The missing scanline should be a half scanline on the real hardware
Verdauga Greeneyes
Regular
Posts: 347
Joined: Tue Mar 07, 2006 10:32 am
Location: The Netherlands

Post by Verdauga Greeneyes »

By the way, this may already be clear to all of you, but for colour bleed the distribution of light for a scanline can be assumed to be gaussian, i.e. it might look something like the below: (where the striped part is the scanline the light was intended for and the regions outside it are the scanlines above and below)
Image
Note this spread is probably a bit wide (it has about 15.7% bleed on either side of the central scanline); it's only an example.
Last edited by Verdauga Greeneyes on Fri Aug 29, 2008 11:42 pm, edited 3 times in total.
FirebrandX
Trooper
Posts: 376
Joined: Tue Apr 19, 2005 11:08 pm
Location: DFW area, TX USA
Contact:

Post by FirebrandX »

The game I remember most for interlaced double res (or whatever the mode was it used) is RPM Racing. The menu select screens are all in high-res.

Edit: and the tracks were in interlace highres too while the car sprites were in low res. It looks like shit when you play it in bsnes because "comb teeth" start showing up on the track graphics when you scroll around the track.
Last edited by FirebrandX on Fri Aug 29, 2008 10:50 pm, edited 1 time in total.
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

Verdauga Greeneyes wrote:By the way, this may already be clear to all of you, but for colour bleed the distribution of light for a scanline can be assumed to be gaussian, i.e. it might look something like the below: (where the striped part is the scanline the light was intended for and the regions outside it are the scanlines above and below)
Image
Note this spread is probably a bit wide (it has about 15.7% bleed on either side of the central scanline); it's only an example.
Yeah i read it was bilinear before but its guassian indeed. that 15,7 is very accurate actually, most tv's are said to be set to 0.7 kell which results in a bleed on each side of about 15%, the official standard is 0.85 according to the same sites
FirebrandX wrote:The game I remember most for interlaced double res (or whatever the mode was it used) is RPM Racing. The menu select screens are all in high-res.


how does my last image appear to you?
FirebrandX
Trooper
Posts: 376
Joined: Tue Apr 19, 2005 11:08 pm
Location: DFW area, TX USA
Contact:

Post by FirebrandX »

what image?
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

FirebrandX wrote:what image?
http://board.zsnes.com/phpBB2/viewtopic ... 066#176066


--------------------

I also figured out a way to show the kell factor, by using a factor of 0.75.

2 line doubled scanlines for 1 black scanline.

The image would be 960x729 but it should be a lot more convincing.
FirebrandX
Trooper
Posts: 376
Joined: Tue Apr 19, 2005 11:08 pm
Location: DFW area, TX USA
Contact:

Post by FirebrandX »

Oh, I thought you were referencing some other image, so I was confused. Only thing I can say on those is it would look better with "smart resizing" so the pixels will look more averaged horizontally. For what I'm talking about, look at Link's hearts and their white outlines, you can see some of the pixels are oblong from point-resizing.
tetsuo55
Regular
Posts: 307
Joined: Sat Mar 04, 2006 3:17 pm

Post by tetsuo55 »

FirebrandX wrote:Oh, I thought you were referencing some other image, so I was confused. Only thing I can say on those is it would look better with "smart resizing" so the pixels will look more averaged horizontally. For what I'm talking about, look at Link's hearts and their white outlines, you can see some of the pixels are oblong from point-resizing.
Yeah thats the rounding error >_<, paint isn't very smart when it comes to stretching
FirebrandX
Trooper
Posts: 376
Joined: Tue Apr 19, 2005 11:08 pm
Location: DFW area, TX USA
Contact:

Post by FirebrandX »

I did one up for ya that uses smart resizing:

Image
Locked