Proposal for anti-shimmer technique when scrolling

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Proposal for anti-shimmer technique when scrolling
by on (#187943)
While looking at the level screens in this thread, i began to wonder about the circumstances for the dreaded "shimmer" effect that can happen to moving graphical objects with certain dither patterns.

Assuming the scrolling goes left and right, how about a pattern table* animation where the dither tiles change from original to a horizontally mirrored clone (or 1px adjusted, depending on how you see it) for each 1px increment of the scrolling. So even/odd positions correspond to A and B in the image below.

*or nametable, if the layout was simple enough to permit it.

Attachment:
anti-shimmer.png
anti-shimmer.png [ 816 Bytes | Viewed 2956 times ]


Same should work (if it works, initially) in tiles with mixed dither and background content (like the mountains in said thread) - by adjusting the dither 1px, but not the mountain contour.

What do you think? Would this help reduce or eliminate the shimmer?

(edit: removed duplette inline placement - i should never post using the phone)
Re: Proposal for anti-shimmer technique when scrolling
by on (#187951)
I have this suspicion that dithering between noticeably different brightnesses will always shimmer, because of NTSC.

For any given pixel of color C at any given fixed location on screen, regardless of the scroll value, there are three possible encodings from the 2C02.

At a specific (X,Y) on an NTSC screen it will only ever use exactly two of those three encodings, selecting based on (X-Y)%3 and whether whether this field is missing its pixel or not.

In order to prevent the shimmering, we'd need to maintain a constant average brightness within a pixel, while simultaneously maintaining the chroma angle within that pixel. The NES doesn't really give you that much rope. (The SNES does, however...)


Given that you seem to be suggesting "change the tile to keep the same pixel X,Y lit" ... yeah, that does sound like should help? But it could make for a weird moiré sensation.
Re: Proposal for anti-shimmer technique when scrolling
by on (#187952)
I made a test ROM a little while ago to demonstrate the "3s" pattern of the NES NTSC colour artifacts:
https://forums.nesdev.com/viewtopic.php?f=2&t=15080

The simplest way is just to scroll 3 pixels at a time, or some multiple of that. It's kind of hard to work in 3s with 8x8 / 16x16 tile restrictions though. Scrolling by 2 is also fine if your patterns are in 2s, like the ones in your example (without using the technique you propsed). Shimmering tends to be most noticeable when scrolling is slower, though, so maybe neither of these cases is very helpful.

Dithering vertically but not horizontally (i.e. horizontal stripes) can also work pretty well.

I think your technique would reduce shimmer on the dither tiles, but it would still show strong diagonal artifacts in the 3s pattern. I'm curious how it would "feel" too to have some of the dither stationary while stuff moves around it, so I hope you try it out.
Re: Proposal for anti-shimmer technique when scrolling
by on (#187955)
Maybe if you changed the BG tileset as you scrolled (MMC3 style) so that the pattern never moves on the actual TV...

IE, if you scroll 1 pixel to the right, the tileset will load a pattern shifted by 1 pixel.
Re: Proposal for anti-shimmer technique when scrolling
by on (#187957)
dougeff wrote:
Maybe if you changed the BG tileset as you scrolled (MMC3 style) so that the pattern never moves on the actual TV...

IE, if you scroll 1 pixel to the right, the tileset will load a pattern shifted by 1 pixel.
That's exactly what they suggested.
Re: Proposal for anti-shimmer technique when scrolling
by on (#187967)
One problem is that regular dither patterns don't look good on the NES to begin with (scrolling or no scrolling), so most good artists will avoid those in the first place.
Re: Proposal for anti-shimmer technique when scrolling
by on (#187971)
rainwarrior wrote:
I'm curious how it would "feel" too to have some of the dither stationary while stuff moves around it, so I hope you try it out.


I'm wondering this too, so it's a nice project that fits on my learning-to-code roadmap. My guess is that this would be best applied to distant objects (as a sort of a poor version of parallax techniques with limited use). But i'm even more curious to see how it feels when applied to, say, a structure that's supposed to be close behind the player object.

tokumaru wrote:
One problem is that regular dither patterns don't look good on the NES to begin with.

I'm generally agreeing with this sentiment. I think dithering on the NES is best used to either make things look grimey, indistinct, soft, fuzzy, or to provoke colour artifacts to make the screen seem to have more colours than permitted, but it's an effect that's sensitive to circumstance. I guess this case goes in the 'for the sake of knowing' department, probably with a slight chance of seeing some practical use.