Shader for flickering interlace?

Hi

does any of the shaders in RA have the effect like Mame HLSL where it can emulate flickering between lines like Amiga interlace?

i love the effect from Mame when running 120hz monitor i gives a good CRT effect

You can add a flicker.cg shader pass and tweak the brightness for it in the parameters. It’s located in the “misc” folder.

EDIT: Oh nevermind, I think you want something different. This flickers the whole screen.

It could be its not possible with Open GL, i think the HLSL is written specific for Nvidia

The interlacing.cg shader will properly flicker alternating fields on interlaced content, but it only looks decent at even 2x and 4x integer scales. It’s intended specifically for use on CRTs running at 480p.

You can put it as a first pass at 2x scale and then follow it with another CRT shader, for example, like crt-hyllian.cg. CRT-geom and crt-royale also have interlacing detection built-in.

I also looked into this issue. The best example is “Animanics” for the SNES. The shadows of the main characters are always flickering.

Example Video: https://youtu.be/rRpTLo8x2EE?t=2m46s

It is difficult to find an algorithm for this detection. I guess the frequency of the flickering is the half of the CRT refresh rate (NTSC would be 60 Hz means, 30 shadows per second - PAL would be 50 Hz means, 25 shadows per second).

The only possibility I could imagine is to cache the frames and to look onto several frames before and after the main frame. However this will delay the output of the image and consequently the reaction time will be affected (input delay).

I think that’s another issue, but probably the easiest thing would be to compare a pixel with the same location 1 and 2 frames earlier. If it’s the same 2 frames back but not 1 frame back, blend the current frame’s pixel with the previous frame’s pixel. This wouldn’t affect latency but it would miss any flickering shadows that move around.

The code used in Mame looks like this http://pastebin.com/MjiXG7b3

and this is what should be added to Mame.ini to test out my interlace effect http://pastebin.com/0QwzGd7N

The function that does this is called “scanline_jitter” and have only seen this effect exist in DX shaders

This could lead to interessting results. Imagine the screen is always moving. So you also have to add a detection concerning the color. I dunno if flickering is only used with black. But flickering is in general used to generate some kind of transparency effect. It was an alternative approach to dithering, especially for shadows.

So you have to compare the last frames to see if a colored pixel and a black pixel are alternating . But due to the movement in the picture (character or objects) the boundaries of the flickering shadow will still flicker. Example: C = Color Pixel; B = Black Pixel Frame 1 -> Frame 2 -> Frame 3 -> Frame 4 (current) -> Frame 5 (future) -> Frame 6 (future) CCCCC -> CBBBC -> CCCCC -> CCBBB -> CCCCC -> CCCBB

In this example the shadow is moving from left to right. If Frame 1-3 would be in the buffer the second pixel in the 5 pixel row would not be detected anymore, because it stays colored. Consequently the most right Black Pixel will always flicker.

P.S Yes, it is another effect / issue =)

[QUOTE=papermanzero;41455] I dunno if flickering is only used with black.[/QUOTE] It’s not. Some games use a similar technique of draw/don’t draw character to get transparency - not just with shadows.

Simply averaging the current frame with the previous one produces surprisingly good results. Once you consider the effects of monitor reaction speed and human persistence of vision, the visual effects of doing this are relatively minor.

It’s also really easy to implement - only three new lines in crt-pi. If you want to try it:

Add a new sampler definition for the old frame below the existing one (it must be called PrevTexture): uniform sampler2D PrevTexture;

After reading the current frame’s texture, read the previous frame’s texture and merge it with the following two lines: colour += texture2D(PrevTexture, tc).rgb; colour /= 2.0;

Of course, some games actually want a flickering effect (e.g. for monitor screens) and whatever you come up with for eliminating transparency flicker will eliminate that as well.

Just for clarification. Mock is talking about jitter on the scanlines, not about interlacing/de-interlacing techniques. The jitter is not just a effect, it happen on real hardware CRTs too. I see it often, in conjunction with super-resolutions on my NEC 3PG. The scanline jittering is subtle and quite nicely simulated by the HLSL effect, if not exaggerated values are used.

Can someone make a video of the effect? It would be helpful to see a too-high setting to make sure we can tell what’s happening and then a good setting to see how it’s supposed to look. A 1080p/60 video on youtube would be good, I think.

Here is a video about the interlacing / deinterlacing issue, which is used for transparency. It is also called flickering technique.