Jump to content
IGNORED

New TV effects for Stella


stephena

Recommended Posts

OK, so I've finally found some time to get back to Stella development (although it may be too late with the crackdown on emulators lately). Anyway, the TV effects from the last released version of Stella will be removed for the next major release. So now I'm in the process of replacing it with something else that's easier on resources. The plan is to use Blargg NTSC filtering and have a scanlines option. If you've used the Atari800 emulator, you'll have an idea of where I'm heading with this.

 

So, first the scanlines effect. I'm wondering how it should look. In particular, the base TIA image is ~160x210 pixels. So with a zoom level of 2 (the default) and stretching horizontally, that gives ~640x420 resolution. In this case scanlines are easy; just skip/dim every other scanline. My question is, what happens on higher zoom levels? Do I skip every x scanlines ( where 'x' is the zoom level), do the same as 2x zoom, etc?

 

Or to make the example more concrete, assume we're looking at the plane in River Raid. If the plane has 3 scanlines passing through it at 2x zoom, should it have the same at 3x zoom (in which case each 'scanline' becomes wider), or should they be spaced the same way (in which case more scanlines pass through the plane)??

Link to comment
Share on other sites

...assume we're looking at the plane in River Raid. If the plane has 3 scanlines passing through it at 2x zoom, should it have the same at 3x zoom (in which case each 'scanline' becomes wider), or should they be spaced the same way (in which case more scanlines pass through the plane)??

The scanline should become wider, to keep the same number of scanlines passing through the plane at any zoom level.

Link to comment
Share on other sites

Crackdown on emulators? Anyone care to brief me on this one? I have very little idea of what this constitutes of. Would it be related to the US legal system working more actively against software "piracy" and all that hoopla?

 

About Stella, I'm always glad to hear news about active work being done on it. It's already in great shape, and the new TV filter will only add to the overall polish.

Link to comment
Share on other sites

The following are snapshots at zoom levels 2 - 6 for River Raid, using the first approach (scanlines are stretched wider, with the same number passing through any area of the screen). Note that since this is done in OpenGL, it actually uses blending. That is, the scanlines aren't blacked out, but blended with the background colour (for now, this is set at 50%, but it will be adjustable for the final release).

post-1512-0-60216200-1314214855_thumb.png post-1512-0-81790200-1314214860_thumb.png post-1512-0-94668800-1314214867_thumb.png

post-1512-0-19543400-1314214872_thumb.png post-1512-0-39921500-1314214876_thumb.png

 

The above snapshots use 'NEAREST' filtering for scanlines. There's also the option of 'LINEAR', as shown in the next snapshot (at 5x zoom):

NEAREST: post-1512-0-43155700-1314215424_thumb.png LINEAR: post-1512-0-17851500-1314215419_thumb.png

 

Notice that the LINEAR one blends the scanlines a little more, making them not as pronounced/sharp.

Link to comment
Share on other sites

Crackdown on emulators? Anyone care to brief me on this one? I have very little idea of what this constitutes of.

See this.

 

Would it be related to the US legal system working more actively against software "piracy" and all that hoopla?

No, Atari sent emails to owners of fan sites. One of the emails mentioned "unauthorized console emulation software".

Link to comment
Share on other sites

So, first the scanlines effect. I'm wondering how it should look.

It would be nice for the scanlines option to have different settings. It would be realistic to have two main choices-- progressive (non-interlaced) or interlaced.

 

The interlaced option would work as on a TV-- one field would be drawn using every other scanline; then the next field would be drawn using the "in-between" scanlines that were skipped during the previous field. There could be a secondary setting to control how much each scanline persists between fields, ranging from 0% (the scanlines would be black on the fields where they are *not* drawn) to 100% (they would keep their colors with no fading until the next field where they're drawn).

 

The progressive option would draw each field (or frame, since there's no interlacing) using every other scanline. Then there could be a secondary setting to control how much the colors "bleed" into the skipped scanlines, ranging from 0% (every other scanline would be black) to 100% (every other scanline would be identical to the preceding scanline, effectively doubling its height).

 

Michael

Link to comment
Share on other sites

The following are snapshots at zoom levels 2 - 6 for River Raid, using the first approach (scanlines are stretched wider, with the same number passing through any area of the screen). Note that since this is done in OpenGL, it actually uses blending. That is, the scanlines aren't blacked out, but blended with the background colour (for now, this is set at 50%, but it will be adjustable for the final release).

post-1512-0-60216200-1314214855_thumb.png post-1512-0-81790200-1314214860_thumb.png post-1512-0-94668800-1314214867_thumb.png

post-1512-0-19543400-1314214872_thumb.png post-1512-0-39921500-1314214876_thumb.png

 

The above snapshots use 'NEAREST' filtering for scanlines. There's also the option of 'LINEAR', as shown in the next snapshot (at 5x zoom):

NEAREST: post-1512-0-43155700-1314215424_thumb.png LINEAR: post-1512-0-17851500-1314215419_thumb.png

 

Notice that the LINEAR one blends the scanlines a little more, making them not as pronounced/sharp.

 

Did you see the new HLSL CRT simulation in Mame & Mess ?

 

It's very nice...

Link to comment
Share on other sites

The plan is to use Blargg NTSC filtering and have a scanlines option. If you've used the Atari800 emulator, you'll have an idea of where I'm heading with this.

I think that in regards of NTSC filtering, you should look into Altirra instead. The algorithm in Altirra, while giving essentially the same results, is different in that it does not perform aspect ratio correction in software and leaves it to OpenGL. Blargg's algorithm, on the other hand, scales the screen horizontally by 7/8 and smooths it out, all in software, which is undoubtedly slower (although I haven't made any comparisons on that). When I get some free time, I'm planning to remove the scaling from the NSTC filter in Atari800 and do it in OpenGL.

 

So, first the scanlines effect. I'm wondering how it should look. In particular, the base TIA image is ~160x210 pixels. So with a zoom level of 2 (the default) and stretching horizontally, that gives ~640x420 resolution. In this case scanlines are easy; just skip/dim every other scanline. My question is, what happens on higher zoom levels? Do I skip every x scanlines ( where 'x' is the zoom level), do the same as 2x zoom, etc?

In Atari800 the scanlines are stretched together with the screen, as that is how it looks in reality. It gives ugly results when the vertical zoom is not integral, but when scanlines are OpenGL interpolated it looks OK.

 

It would be nice for the scanlines option to have different settings. It would be realistic to have two main choices-- progressive (non-interlaced) or interlaced.

The issue of emulating interlaced screen modes is unrelated to the original question. Although applying scanlines to an interlaced mode (they would jump up & down by a pixel every other frame) is certainly a neat idea.

Link to comment
Share on other sites

It would be nice for the scanlines option to have different settings. It would be realistic to have two main choices-- progressive (non-interlaced) or interlaced.

For now, I'm concentrating on just adding scanlines as a 'pretty' effect. Integrating it with interlaced mode (which Stella doesn't support yet) will probably come later. At this point, the scanline effect is a "post-processing" filter. That is, the screen is completely rendered, and the scanlines are added afterwards (by blending an OpenGL texture over it). I'm not sure how this would work with interlaced modes yet, since interlacing would be done at a lower level, before the post-processing.

 

Did you see the new HLSL CRT simulation in Mame & Mess ?

This requires OpenGL 2.0+ and GL shading language. This is what I'm trying to move away from in Stella, because it's a little slow, and requires video card and drivers which are a little too advanced. My plan is for the OpenGL TV effects to work with OpenGL ES as well as full OpenGL, so unfortunately shaders are out of the question.

 

Besides, I think going the route of all kinds of video filters is a never-ending path. I prefer to keep things simple (just like a real 2600), and simply have NTSC effects with scanlines. I just don't have the time to do anything more complicated.

Link to comment
Share on other sites

I think that in regards of NTSC filtering, you should look into Altirra instead. The algorithm in Altirra, while giving essentially the same results, is different in that it does not perform aspect ratio correction in software and leaves it to OpenGL. Blargg's algorithm, on the other hand, scales the screen horizontally by 7/8 and smooths it out, all in software, which is undoubtedly slower (although I haven't made any comparisons on that). When I get some free time, I'm planning to remove the scaling from the NSTC filter in Atari800 and do it in OpenGL.

What I meant was like Atari800; it probably won't be exactly the same code and features. All the TV effects in Stella will be OpenGL only, so anything in Blargg filtering that is done in software will be replaced with a (hardware) OpenGL equivalent.

 

In Atari800 the scanlines are stretched together with the screen, as that is how it looks in reality. It gives ugly results when the vertical zoom is not integral, but when scanlines are OpenGL interpolated it looks OK.

OK, this is what I've done in the snapshots above. Vertical (and horizontal) zoom may not be integral when using 'gl_fsmax', which stretches the screen as much as possible while keeping the aspect ratio, but this won't be a problem, as you say.

Link to comment
Share on other sites

Well, depends on what you want to do.

 

If you want to emulate what a hires TV that would have e.g. twice the vertical resolution would do, then every 2600 line would be 4 lines on the TV. And those would not be grouped 2 on, 2 off, but on, off, on off.

 

If you just want to zoom the picture then it would be 2 on and 2 off.

 

For odd numbers (e.g. 3) the TV emulation would still be on, off, on, off etc. But the zoom would have filter intermediate lines (e.g. on, 50% on, off, on, 50% on, off...)

Link to comment
Share on other sites

The interlaced option would work as on a TV-- one field would be drawn using every other scanline; then the next field would be drawn using the "in-between" scanlines that were skipped during the previous field.

That would be annoying as it would result in the whole screen jittering up/down because, with the exception of a few demos, the Atari puts out a 240p signal. The reason the "interlace lines" are visible on a TV is because scan lines are never drawn in those locations, not because it's an interlaced signal.

Link to comment
Share on other sites

The interlaced option would work as on a TV-- one field would be drawn using every other scanline; then the next field would be drawn using the "in-between" scanlines that were skipped during the previous field.

That would be annoying as it would result in the whole screen jittering up/down because, with the exception of a few demos, the Atari puts out a 240p signal. The reason the "interlace lines" are visible on a TV is because scan lines are never drawn in those locations, not because it's an interlaced signal.

(1) The primary point of my suggestion is to enable emulation of an interlaced screen for those programs that display an interlaced screen. A secondary benefit would be that the screen would match what I see on my HD LCD TV for *non-interlaced* Atari 2600 screens-- although I don't know how common this behavior is on HD TVs, so I don't know how useful or desirable such a feature would be for other people. In any case, since it would be a setting, don't use it if you don't want it. The default would be non-interlaced (just as it is in the z26 emulator, which has had this option for many years), since that is what the Atari 2600 draws.

 

(2) If the program is drawing an interlaced display on real equipment, then yes, the screen *might* jitter up and down a tiny bit if the graphics are constantly changing on every field. But in most games a large portion of the screen is stationary for at least a couple of frames at a time, if not "permanently" for a given screen (e.g., the platforms in a platform game, or the playfield in general in most other games), so even if the program were drawing an interlaced display, you shouldn't get much perceptible "jitter" (assuming the scanlines for each field are left as-is until the next time they're drawn). Anyway, how would it be different than watching regular interlaced TV? Are you telling me that when you're watching a show that has a lot of fast action-- say, a car race-- that you're annoyed because the whole screen is jittering up and down as the TV draws one field, then draws the next field interlaced between the scanlines of the first one, and so on? *I* don't notice any jitter, but maybe my eyes just aren't good enough (I *do* wear eyeglasses, so it's a fore-gone conclusion that my eyes are "defective").

 

All I can suggest is, try turning on this option in z26 for a non-interlaced game and see whether or not the screen jitters annoyingly.

 

Michael

Edited by SeaGtGruff
Link to comment
Share on other sites

(1) The primary point of my suggestion is to enable emulation of an interlaced screen for those programs that display an interlaced screen.

Supporting interlaced is a different animal than drawing visible scanlines.

 

A secondary benefit would be that the screen would match what I see on my HD LCD TV for *non-interlaced* Atari 2600 screens

implementing the poor 240p support of your HDTV isn't a good thing.

 

Are you telling me that when you're watching a show that has a lot of fast action-- say, a car race-- that you're annoyed because the whole screen is jittering up and down as the TV draws one field, then draws the next field interlaced between the scanlines of the first one, and so on?

Doesn't sound like you're familiar with how interlaced TV works. You won't see jitter, but combing.

Interlaced_video_frame_%28car_wheel%29.jpg

 

Combing is not that noticeable on an interlaced display as the phosphors typically have faded enough to make it subtle . When shown on a progressive display, combing is very noticeable. Progressive based TVs attempt to filter that out with a deinterlace processing. Some TVs (most likely yours) incorrectly process a 240p signal as though it were 480i, which results in weird visual effects for the Atari and other classic consoles.

Link to comment
Share on other sites

I've went through some of my old messages, and remembered that the Georgia Tech guys sent me another code drop that had Blargg filtering and various TV 'aperture' setting. I'm going to look into integrating that as soon as I get a chance, hopefully sometime in the next month or so. Depending on how that works out, then I'll consider how to implement scanlines and interlacing.

 

EDIT: The reason I never added this is because it wasn't as polished as the current TV filters, and I didn't have time to fix it myself. In particular, it currently only works in NTSC mode at specific zoom levels, there's no way to tweak any of the knobs, etc. As well, there's overlap between the current phosphor functionality (which is really just a software approximation) and OpenGL phosphor (which would blend multiple frames together and give a much more accurate effect).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...