Reducing Emulated Temporal Aliasing

Previous: Decoding a Fake NTSC Signal


Some systems (Such as the NES and SNES) alternated the generated reference phases every other frame to reduce the aliasing that occurred due to how their scanlines were generated. Here's a slowed-down example (using some definitely real pixel art and not just some garbage made for this demo):

When this ran at a smooth ~60Hz on the system, the jagged edges and other color artifacts blended together in the player's eye and ended up looking more like:

This looks better! However, when running from an emulator, it's possible that it doesn't run at a perfect every-other-frame rate. Or, maybe you want to take screenshots of your retro-styled game and not have them look like a jagged mess. For that reason, when we're generating emulated signals, it is possible to use the power of GPUs to effectively generate two signals for the same frame using two alternating phases then average them together on decode to skip the jigglevision artifacts and go straight to the smooth way that it ended up looking to users anyway.

Multiple Phases

At the beginning of the generation process, we generated a phases texture (for display purposes, it has been rotated 90° and scaled vertically):

That is a one-channel texture with one reference phase per scanline. If, instead, we were to generate a two-channel texture (note that the red and green channels are distinct):

...we could use two phases per scanline to generate two carrier waves per scanline and, then, two sets of luma/chroma information per frame (again, if you look closely you'll note that the red and green channels are different):

This, then, can be separated back into two sets of luma/chroma information per frame (a four-channel dual S-Video-like texture instead of a standard two-channel S-Video texture), and then decoded from there into two RGB images of the same frame.

(In practice, we don't decode into two separate RGB images, it just does two decodes and an average in the same shader to save on texture bandwidth, but it has the same effect).

CRTs

However we end up with an RGB image, it can then be fed into an emulation of a CRT TV to complete the effect!

Next: Faking a CRT Display