Jump to content
IGNORED

NTSC - PAL - color matching (Altirra default palettes)


Recommended Posts

I've just spent a little time messing with toggling between PAL and NTSC modes for the Atari emulator in Altirra, and realized what I wanted was a reference chart for "matching" colors between the two palettes. For my next assembler project, I want to write some nifty code that checks the Atari mode (PAL or NTSC), and switches color palette appropriately. The idea being that the colors used are "close enough" the same in either mode.   

 

After carefully capturing all possible colors for both modes (with a little test program), I extracted their RGB values (using a paint program), and wrote a Python program to automatically compute the minimum distances between pairs of colors (think minimum distance between two 3D points in a "color cube" with R, G, B axes -- yay, Pythagorus). The result is a standalone HTML page that gives the closest matches between the NTSC and PAL palettes which can be used to select pairs of Chroma-Luma codes.

 

Perhaps someone else might find this useful in the future... 

 

NTSC-PAL-color-match.png.63b1a79bc90ec749ed946e665f71fee5.png  

ntsc-pal-match.html

  • Like 7
  • Thanks 3
Link to comment
Share on other sites

4 hours ago, simonh said:

I've just spent a little time messing with toggling between PAL and NTSC modes for the Atari emulator in Altirra, and realized what I wanted was a reference chart for "matching" colors between the two palettes. For my next assembler project, I want to write some nifty code that checks the Atari mode (PAL or NTSC), and switches color palette appropriately. The idea being that the colors used are "close enough" the same in either mode.   

 

After carefully capturing all possible colors for both modes (with a little test program), I extracted their RGB values (using a paint program), and wrote a Python program to automatically compute the minimum distances between pairs of colors (think minimum distance between two 3D points in a "color cube" with R, G, B axes -- yay, Pythagorus). The result is a standalone HTML page that gives the closest matches between the NTSC and PAL palettes which can be used to select pairs of Chroma-Luma codes.

 

Perhaps someone else might find this useful in the future... 

 

ntsc-pal-match.html 21.61 kB · 7 downloads

 

TBH, most of what's shown here can already be computed by simple transposition (which is how I basically do it); so, no need to consult any chart; and for the few that may need some hand-choosing, I can do a better job than what I'm seeing here. I find some of the choices to be a bit questionable; although that may be due -- in part -- to the particular palettes being used here (which might differ somewhat from what I personally use in emulation; but I will say that I've also used the same method I mention here to choose colors on real hardware for both, as well).

 

Edited by MrFish
Link to comment
Share on other sites

On 10/5/2021 at 4:02 AM, Wrathchild said:

Also having looked into colourspace distances, e.g. think 'Rasterconverter', the Delta-E 1994 is better.

 

Speaking of RasterConverter... a nice update for it would be the ability to produce PAL & NTSC versions for a single image. Failing that, some type of simple command-line conversion tool that could produce one from the other would suffice.

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

On 10/6/2021 at 2:57 PM, MrFish said:

 

Speaking of RasterConverter... a nice update for it would be the ability to produce PAL & NTSC versions for a single image. Failing that, some type of simple command-line conversion tool that could produce one from the other would suffice.

 

A simple conversion would not be possible since color register values may be reused as player positions and vice versa. For example, if the program determines that the optimal 6502 instruction stream at some point in the middle of the screen for NTSC is as follows:

 

...

LDA #$3C

STA COLPF1

STA HPOSP3

...

 

Then, you can't simply change the LDA #$3C to LDA #$2C for PAL because that will also change the position of player #3.

 

You pretty much have to rerun from scratch to target a different palette. I suppose the tool could have an option to work on PAL and NTSC versions simultaneously but it will double the amount of computation necessary, so it would anyway be comparable to running the tool twice.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

1 hour ago, Xuel said:

A simple conversion would not be possible since color register values may be reused as player positions and vice versa. For example, if the program determines that the optimal 6502 instruction stream at some point in the middle of the screen for NTSC is as follows:

 

...

LDA #$3C

STA COLPF1

STA HPOSP3

...

 

Then, you can't simply change the LDA #$3C to LDA #$2C for PAL because that will also change the position of player #3.

 

You pretty much have to rerun from scratch to target a different palette. I suppose the tool could have an option to work on PAL and NTSC versions simultaneously but it will double the amount of computation necessary, so it would anyway be comparable to running the tool twice.

 

You know, I've seen similar things in older games that I've hacked on: sometimes a value loaded into the accumulator would be used to populate a player and then one of the playfield colors. I assumed -- in some cases -- it was done to enable a game to fit on a certain smaller-size ROM cartridge (8K or 16K); this would be a situation where even a few saved bytes could be important.

 

So, I guess in RastaConverter's case it's more of a cycle-saving measure. Now I can see why fiddling with the *.MCH file in Graph2Font sometimes produces strange results.

 

Alright, so, scrap that. Thanks for the info.

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...