It is currently Tue Oct 24, 2017 4:41 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Weird visual effects
PostPosted: Fri Nov 18, 2005 10:17 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
I finally thought our game was ready for the NES console so I burned the EPROM chips and put it in the NES. Much to my surprise it actually worked. There are some weird effects which you couldn't see on either FCEUD or Nintendulator. First of all, some background tiles seemed to be missing some colours on the lateral screen edges. Also the sprites were definitely different on the console as opposed to the emulator. Some sprites lacked good contrast so certain features such as the faces were very blurred. I think that certain palette combinations just don't show up well. Also when the sprites were moving there was a weird shimmering effect almost like a moire pattern. Not all the sprites had it which made me wonder if it is my sprite cycling routine to avoid flicker when there are more than 8 sprites per scanline. I also put #$FF into all sprite RAM that isn't being used so that any unused sprites will be in the #$FF line which is invisible. (I reverse the sprite ram every second frame.) I wonder if somehow I'm putting "garbage" into the sprite RAM which is there just long enough to make the weird shimmering. If anybody has any ideas why it only shows on the console let me know. At least the game worked pretty well.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 18, 2005 11:13 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1390
It's certainly possible that it's a problem with your NES or your television set, or just a bad video connection. Are you using a front loader, top loader, or Famiclone?

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 19, 2005 1:10 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19122
Location: NE Indiana, USA (NTSC)
Or it could be that you chose colors that just won't show up right on NTSC. The NES PPU's color encoder doesn't like colors of the same value (upper digit) but different hues (lower digit $1 through $C) next to each other on the same scanline. You'll get shimmering and muddiness if a lot of your scene uses colors this way. Could you post a screen shot from Nintendulator showing what the image is supposed to look like?


Top
 Profile  
 
 Post subject: Weird visual effects
PostPosted: Sun Nov 20, 2005 5:56 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
I'm using the front loading NES. I just put all the files for the game and a Nintendulator screen shot on my website. The FCEUD emulation actually looks closer to the actual console/TV combination with the colours looking brighter and less muddy than the Nintendulator output. I'm going to play around with the palette. I had no idea you had to watch out for transitions where the colours shared the same high nibble and had a different lower nibble. I'm also going to try and output the video card to play the emulator on a TV to see if the sprite problem shows up that way.

http://www3.sympatico.ca/lloyd.gordon3/


Top
 Profile  
 
 Post subject: Weird visual effects
PostPosted: Sun Nov 20, 2005 7:24 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
I just hooked the TV/OUT of my video card and watched the game on the TV with FCEUD playing. The colours of the background were the same all over the screen so I'll have to move the NES upstairs to try the other TV and see if it's a NES/code problem or just a specific TV. The sprite colour contrast shows the same muddiness so I guess I'll have to adjust the palette to avoid the NTSC palette upper/lower nibble contrast effect. The wierd movement artifact was definitely not showing so it must have something to do with my code as it plays on the NES. Certainly no commercial game ever had the movement artifact so maybe it's the way I set up my sprite DMA memory. Anybody ever seen this kind of movement artifact?


Top
 Profile  
 
 Post subject: Re: Weird visual effects
PostPosted: Sun Nov 20, 2005 7:38 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19122
Location: NE Indiana, USA (NTSC)
Lloyd Gordon wrote:
The wierd movement artifact was definitely not showing so it must have something to do with my code as it plays on the NES. Certainly no commercial game ever had the movement artifact

Fire up Super Mario Bros. and start World 1-2. Move forward at various speeds and notice the edges of the blue bricks.

Quote:
so maybe it's the way I set up my sprite DMA memory. Anybody ever seen this kind of movement artifact?

Unless you show us a picture, possibly with screen shots taken through TV-input or a digital camera, we can't really know what kind of artifact you're talking about.


Top
 Profile  
 
 Post subject: Weird visual effects
PostPosted: Sun Nov 20, 2005 10:15 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
Thanks for your thoughts. I tried SMB and didn't really notice any weird effects but I probably didn't know what I was looking for. Certainly I've never seen anything like the weird Moire like pattern before. I'm going to try and get a video posted soon. Or if anybody is ambitious they could put my game into a devcart and play it. (Just kidding).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 28, 2005 5:51 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
I finally got a video clip on my website. My camcorder and digital camera couldn't really show any details and my video capture card isn't working so I finally recorded through the AV output of the NES directly into my camcorder and then recorded it on the computer using firewire. It's still not ideal but it does show a weird rippling effect on the moving sprites almost if there were something else "behind" them. It looks more like a moire effect on the actual TV when it's played on the NES console. If anybody has any ideas, please let me know. I move the sprites 1 pixel per frame for the player sprites and 1 pixel per 2 frames for the enemy sprites. I reverse the sprite DMA order on every second frame to lessen the "8 sprites per scanline blanking effect". I have no idea why it makes the weird rippling or moire effect for the moving sprites. Thanks for any help.

http://www3.sympatico.ca/lloyd.gordon3/


Top
 Profile  
 
PostPosted: Mon Nov 28, 2005 10:23 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19122
Location: NE Indiana, USA (NTSC)
Lloyd Gordon wrote:
It's still not ideal but it does show a weird rippling effect on the moving sprites almost if there were something else "behind" them.

There is something else "behind" the sprites; it's the NTSC color subcarrier. If the edges of your sprites are saturated colors, then they may have shimmering artifacts when they move at certain speeds. It's just the nature of cheap NTSC encoders used during the NES era (and to a lesser extent during the Super NES era, which can be demonstrated in Mario Paint). Even the PlayStation isn't immune; try firing up a PS1 game and looking closely at the left side of the big "P" on the black screen to see dot crawl.

Quote:
It looks more like a moire effect on the actual TV when it's played on the NES console.

It depends on how cheap your TV's comb filter is.

Quote:
I move the sprites 1 pixel per frame for the player sprites and 1 pixel per 2 frames for the enemy sprites.

Perhaps your sprites are moving at speeds that beat with the NTSC color subcarrier. You don't notice this as much in Super Mario Bros. because at least some objects have a proper fixed-point displacement and velocity, which causes the sprite positions not to line up on any particular pattern of color subcarrier positions.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 11:52 am 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
Thanks very much, Tepples. The people on this messageboard are certainly full of expert information. How does "saturated colours" correspond to the NES palette colour choices? Would having a coloured background or a tiled background make the NTSC effects less annoying? How can I adjust my sprite movement to minimize NTSC effects? Even with lots of searching around I've never seen anything like the information about the subtle video (NTSC) colour and video effects that people here know about. Are there any good references that would help me with these effects? Thanks again.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 1:12 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3473
Location: Indianapolis
I've never seen anything like that either, so I'm at a loss to explain what the deal is. I notice it a little bit in games usually (especially with scrolling backgrounds and stuff), but not as much with sprites or to the degree in the video you posted.

How are you doing the movement now, just by pixels per frame? If you use fixed-point stuff you could have a lot more variations in speed (and if it helps with the shimmering effect, bonus). You'd do that by making the sprite position and velocity 16-bit numbers. Then for displaying the actual sprite position, just use the upper 8-bits.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 3:30 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
You might try this, which causes a different dot crawl pattern than the usual (I think this one repeats every 3/60 second, rather than 2/60 second). It keeps PPU rendering disabled until after the even/odd frame length difference would take effect. I was able to use a delay from 2368 to 2440 (70 clock variance). Larger delays missed important events on scanline 21. Presumably you'd have code in place of the delay which did something useful during that time, but didn't vary by more than 70 clocks.

Code:
nmi:  lda   #$00  ; disable bg+obj
      sta   $2001
     
      ldy   #215  ; 2368 delay
      ldx   #1
delay:
      dex
      bne   delay
      ldx   #1
      dey
      bne   delay
     
      lda   #$18  ; enable bg+obj
      sta   $2001   ; write at NMI+2379
     
wait: jmp   wait


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 9:50 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
Hi Memblers and Blargg,
I sort of see (or maybe I don't) what you mean but I had no idea you had to be so careful about sprite movement and position. I thought that sprite position was changed by writing to the X and Y coordinates. Near the beginning of the NMI I write to sprite RAM with the DMA. After that I run the code that alters the various sprite positions. As I said the "player" sprite moves according to the joystick at up to one pixel in the X and Y axes per NMI. I made the "enemy" sprites move 1 pixel in the X/Y axes every second NMI so the player would be able to get away or attack them easier. Then on the next NMI the updated X,Y sprite coordinates are written again with by sprite DMA. This is all new to me and I guess I will have to rewrite all my sprite movement code. I knew I was doing it in a simplistic way but I didn't realize how strange it would look. If you have any more pointers, please let me know.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 29, 2005 10:55 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
There is essentially a grid-like pattern overlayed over areas that have lots of different colored pixels. This pattern is constantly moving smoothly so that it's not that visible since you see the average of the pattern. But when you move an object in sync with it, you are able to "capture" the pattern and avoid having it average out. If you are able to move the object at a slightly different rate, you'll get some of the averaging effect (since the pattern will still be moving in relation to the object). You can see the pattern if you carefully scan your eyes smoothly across a normal television picture (but not a modern computer monitor).

If you keep some fractional precision to your sprite positions, you can easily move them at non-integral velocities, i.e. 1.3 pixels per frame rather than just 1 or 2 or 3 pixels per frame. The NES has no knowledge of fractional pixels, so you keep this internally and use the whole part when setting the actual sprite position. Since the pattern moves at an integral velocity (1 pixel per frame), you can use this to avoid falling exactly in sync.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 8:35 pm 
Offline
User avatar

Joined: Mon Nov 07, 2005 11:32 am
Posts: 150
Location: Toronto
I think I actually (maybe) understand what you mean. I'm going to try and modify my code to use the fractional velocity. Thanks again. How come I've never seen this on commercial games? Although I think I can recall a slight but similar effect on some games. Did the commercial programmers know about these effects and avoid them? I guess I unknowingly coded my enemy sprites to maximize the distortion.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group