stella-emu / stella

A multi-platform Atari 2600 Emulator
https://stella-emu.github.io
GNU General Public License v2.0
608 stars 112 forks source link

True TV colours - request/suggestion #538

Closed andrew-davie closed 4 years ago

andrew-davie commented 5 years ago

I was rather surprised to see a video of Sokoboo running on an NTSC television where the colours on the TV were significantly different than on Stella. Yes I know NTSC is "never the same colour" and that there is a "hue" knob of some sort. But it wasn't just the colour, it was the intensity too.

I'm wondering if it might be possible to calculate the ACTUAL colours (or signal, more to the point) sent in a NTSC atari to the TV? That is, put a scope on the signal, perhaps, and interpret the colour-burst? Or even dig up the hardware specs of the chip doing the colour burst data? And then, offering a "hue" control in Stella?

Basically I'm having a real hard time figuring out what should be the colours/intensities to use when a) every emulator is basically different, and b) Stella is different to the TV pictures I saw and c) different TV pictures also look different.

thrust26 commented 4 years ago

Stella already offers user defined palettes. So you can define a number of palettes and then find the best compromise for your colors chosen. Maybe you find someone on AtariAge who volunteers to provide the necessary values.

Simulating the various combined settings and inaccuracies of the analog hardware in Stella seems like overkill to me.

ghost commented 4 years ago

I guess an EE person at AtariAge would have to measure the raw color signals or voltages from the console. Then convert to RGB.

I know some NES emulators support this feature. https://github.com/SourMesen/Mesen/blob/master/Core/RawVideoFilter.cpp

And I think TmEE of nesdev logged console voltages for Sega consoles like SMS and Megadrive.

But no one I've heard has yet done it for Atari or NEC consoles.

edit: I have to manually adjust the hue -16 for NES games to get the tint more right (purple becomes rusty red). This is during conversion phase though.

sa666666 commented 4 years ago

The latest version of z26 (4.07 I believe) is reported to have something like this (I haven't tried it out). They say it comes from the latest MAME code. So perhaps we can look there for ideas. All these projects are now under GPLv2, so we're free to re-use code if we like.

thrust26 commented 4 years ago

Looking into this now...

thrust26 commented 4 years ago

I looked into z26 and MAME code. Overall they are doing the same. While MAME strictly follows a function, z26 does a pretty big, manual correction of base color values (see line 33 in attached file).

The comments says:

// phase corrections since the 2600 doesn't generate perfect sine waves // Set corrections for chroma1 and chromaF to be the same to get // phase shift numbers to match mame numbers.

Does anyone have any more information about these imperfect sine waves?

palette.zip

thrust26 commented 4 years ago

Implemented with dd7dbae