About the NES palette and Neslib.

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
About the NES palette and Neslib.
by on (#147021)
I'm currently developing a game using the latest Neslib release Shiru sent me a while ago (with extra modifications by yours truly). While designing the graphics, I noticed how I couldn't use the darkest shades of gray I found in every palette I could locate in the web (this is, value $1D) because ingame it wes rendered as mid-gray (like $00).

As we had used this very colour ($1D) in Sir Ababol, which used an older version of neslib, and it was rendered OK, I took a look at the sources and found this:

Older neslib palette table (section):
Code:
   .byte $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$0c,$0f,$0e,$0f   ;4 normal
   .byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$1f,$1e,$0f
   .byte $20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$2d,$2e,$0f
   .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$3d,$3e,$0f


Newer neslib palette table (section):
Code:
palBrightTable4:
   .byte $00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0a,$0b,$0c,$0f,$0f,$0f   ;normal colors
palBrightTable5:
   .byte $10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$1a,$1b,$1c,$00,$00,$00
palBrightTable6:
   .byte $10,$21,$22,$23,$24,$25,$26,$27,$28,$29,$2a,$2b,$2c,$10,$10,$10   ;$10 because $20 is the same as $30
palBrightTable7:
   .byte $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$3a,$3b,$3c,$20,$20,$20


As you see, values for de $?D column have been changed to different values: $0d, $1d, $2d and $3d are now $0f, $00, $10 and $20. Now I seem to recall having read somewhere that some colours were advised against, or even harmful (!), any insights?

Is it safe if I change the values back to the original ones? That dark gray was really useful.
Re: About the NES palette and Neslib.
by on (#147022)
$1D, $2D and $3D are completely safe to use. The only problematic color is $0D, so don't use that one.

Also note that $2D and $3D are black on Nintendo's official RGB PPUs, so that's one reason to avoid them if possible. That said, the RGB PPU is fairly rare.
Re: About the NES palette and Neslib.
by on (#147032)
The only real problem with $2D/3D grey is that some emulators (i.e. FCEUX) use a default palette that makes is the same colour as $00/10.

As long as your fadeout knows how to avoid $0D, it won't cause a problem with a real NES+TV.
Re: About the NES palette and Neslib.
by on (#147033)
You probably don't need to use the $xD column at all, as all the colors are duplicates or very close to duplicates of other colors. See NTSC video.

  • $1D is black. The PPU outputs the same voltage for $0E, $0F, $1D, $1E, $1F, $2E, $2F, $3E, and $3F.
  • $2D is dark gray. The voltage that the PPU outputs for $2D is very close to that for $00.
  • $3D is light gray. The voltage that the PPU outputs for $3D is very close to that for $10.
Re: About the NES palette and Neslib.
by on (#147047)
thefox wrote:
Also note that $2D and $3D are black on Nintendo's official RGB PPUs, so that's one reason to avoid them if possible. That said, the RGB PPU is fairly rare.

The RGB PPU has such a horribly broken palette anyway that you're better off avoiding it in the first place.
Re: About the NES palette and Neslib.
by on (#147148)
Thanks for the replies, guys :)