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.
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)
Proposal for anti-shimmer technique when scrolling
Moderator: Moderators
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Proposal for anti-shimmer technique when scrolling
Last edited by FrankenGraphics on Sun Jan 29, 2017 1:46 am, edited 1 time in total.
Re: Proposal for anti-shimmer technique when scrolling
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.
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.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Proposal for anti-shimmer technique when scrolling
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.
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
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.
IE, if you scroll 1 pixel to the right, the tileset will load a pattern shifted by 1 pixel.
nesdoug.com -- blog/tutorial on programming for the NES
Re: Proposal for anti-shimmer technique when scrolling
That's exactly what they suggested.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.
Re: Proposal for anti-shimmer technique when scrolling
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.
- FrankenGraphics
- Formerly WheelInventor
- Posts: 2064
- Joined: Thu Apr 14, 2016 2:55 am
- Location: Gothenburg, Sweden
- Contact:
Re: Proposal for anti-shimmer technique when scrolling
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.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 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.tokumaru wrote:One problem is that regular dither patterns don't look good on the NES to begin with.