A SNES palette questions/inquiry (possibly silly questions)

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

Proper color scaling is easy.

Code: Select all

//call this for each color channel, obviously it won't work on a packed pixel
uint64_t normalize(uint64_t color, unsigned sourceDepth, unsigned targetDepth) {
  while(sourceDepth < targetDepth) {
    color = (color << sourceDepth) | color;
    sourceDepth += sourceDepth;
  }
  if(targetDepth < sourceDepth) color >>= (sourceDepth - targetDepth);
  return color;
}
Or in other words: keep repeating the bits until you've filled in all of your new bits. 5-bit ABCDE becomes 8-bit ABCDE-ABC. 00000 -> 00000 000. 11111 -> 11111 111.

ZSNES, from my testing, was using an RGB55 (or 565, I forget) surface with DirectDraw, which did not compensate for this. So a solid white screen in that emulator appears as #f8f8f8 (very slightly gray), not #ffffff. They no doubt chose to use a 16-bit surface anyway because it was marginally faster than copying a 32-bit surface. But comparing that slight inaccuracy against the flat-out completely wrong gamma is kind of silly. Images are blindingly bright if you don't correct the gamma difference between a TV and LCD monitor.

Fun side-tangent: SNES brightness register is a luminance adjust, not an RGB555 adjust. As such, it's technically possible to choose from more than 32768 color shades. But good luck computing exactly how many (certainly there's bound to be a lot of overlap between the different luma settings.)
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by tepples »

byuu wrote:Images are blindingly bright if you don't correct the gamma difference between a TV and LCD monitor.
My Vizio VX32L TV is an LCD monitor, you insensitive clod! :-P

But seriously, how do actual, correctly calibrated TVs differ noticeably from the sRGB color space that computer monitor interfaces tend to assume?
User avatar
TmEE
Posts: 960
Joined: Wed Feb 13, 2008 9:10 am
Location: Norway (50 and 60Hz compatible :P)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by TmEE »

byuu wrote:Fun side-tangent: SNES brightness register is a luminance adjust, not an RGB555 adjust. As such, it's technically possible to choose from more than 32768 color shades. But good luck computing exactly how many (certainly there's bound to be a lot of overlap between the different luma settings.)
...It works in analog domain ? The "Shadow/Highlight" function in MD is something that works in analog domain.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

> But seriously, how do actual, correctly calibrated TVs differ noticeably from the sRGB color space that computer monitor interfaces tend to assume?

Assuming you have a correctly calibrated monitor at 50%+ brightness (eg Spyder ICC profile on an IPS panel), the left is what the image looks like if you assume 1:1 RGB, and the right is what the image looks like on your standard CRT TV.

Image Image

Image Image

If your monitor settings are too far off, then the left may look more like your TV. But with a properly calibrated desktop monitor, the left looks like the image is covered in a hazy fog. The right is clear and shows the vibrancy of colors you see on a CRT TV. At least, the right matches my PVM-2030 RGB monitor at stock settings much closer.

> ...It works in analog domain ? The "Shadow/Highlight" function in MD is something that works in analog domain.

It is most likely analog, yes. That's the only way I have to explain the psychotic behavior of luma=0. Instead of being absolute black, it's like 99% black. Much like how you mute a cheap old TV and you can still barely hear it if you put your ears closer. It was cheaper to just reuse the existing analog scaler and hammer the value down as much as possible than to have an actual switch to completely disable the signal.
Last edited by Near on Fri Dec 06, 2013 3:57 pm, edited 1 time in total.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: A SNES palette questions/inquiry (possibly silly questio

Post by tokumaru »

Am I crazy for liking the washed out colors (left) better? =)
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

Probably not.

It's like MP3. People have listened to compressed-to-hell music for so long that they have grown to like the artifacts it causes.

People have been using overly washed out palettes in SNES emulators for the past 16 years, so it's what people are used to seeing.

The gamma-adjusted version can obscure some really dark details, too. But they tend to be on TVs as well. It's a bit like how I used to cheat in Ultima Online by maxing out my monitor brightness inside caves, rather than using night vision items. You were supposed to not be able to see things that well, but with insane brightness, you could see all of the details anyway.

It's an option in my emulator, so you can use either mode. Obviously, as that's how I took those screenshots.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by tepples »

I wonder if it has something to do with the 7.5 IRE "setup" in NTSC outside Japan, where RGB(0, 0, 0) is actually 0 IRE and RGB(2, 2, 2) = 6.5 IRE is the closest to true black.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Re: A SNES palette questions/inquiry (possibly silly questio

Post by blargg »

Could it be due to the fact that the image can be brighter on a TV (as far as I know)? The left ones look better as dim images simply because you can see things more easily than the dark right ones.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

tepples wrote:I wonder if it has something to do with the 7.5 IRE "setup" in NTSC outside Japan, where RGB(0, 0, 0) is actually 0 IRE and RGB(2, 2, 2) = 6.5 IRE is the closest to true black.
No. You can make out the image being displayed if you max out your TV brightness. It's like the color range was reduced by 99%. You can't really simulate it in 24-bit color mode. I output the colors at 48-bit (16-bits per channel), which ends up displayed on my monitor at 30-bit (10-bits per channel.)
Could it be due to the fact that the image can be brighter on a TV (as far as I know)?
You can do that, sure. But I am matching the colors of my stock PVM-2030, and before that, a regular CRT I had previously (don't remember the brand.)

I'm frankly stunned that anyone can look at the left images and like them more (the left outside area looks like broad daylight during a thunderstorm), but to each their own.

Back when my workplace had CRTs still, the right did look way too dark, but that was due to the brightness being turned down pretty low. For which I also have a brightness adjustment setting.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: A SNES palette questions/inquiry (possibly silly questio

Post by lidnariq »

byuu wrote:Back when my workplace had CRTs still, the right did look way too dark, but that was due to the brightness being turned down pretty low. For which I also have a brightness adjustment setting.
Surely you're using calibrated monitors, lest all this effort be lost in that stage...
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

My primary development monitor is an HP ZR-30w, 30" IPS panel. This is a $1300 professional monitor, which was factory calibrated, and I've had it for about a year now. It's been long enough that I should recalibrate it, but I do not own a Spyder.

The gamma correction is also based on standard gamma differences between PC LCDs and CRT TVs.

But anyway, you have full control over this gamma adjustment, and additional brightness/contrast/gamma/hue/saturation adjustment settings. So you can tweak the colors to match your own TV by hand if you like. It's well worth the effort.
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by mikejmoffitt »

Side-note - I have an 8-bit IPS RGB LCD panel. When I am adjusting levels of R,G,B, and the gamma curve, etc. are these adjustments done in the 8-bit digital domain, or are they done with finer granularity? If it is the former, it seems like everything other than output-RGB = input-RGB would decrease usable color depth. I know often the "contrast" control works this way and will result in details being missing / at levels out of proportion with surrounding details.
Near
Founder of higan project
Posts: 1553
Joined: Mon Mar 27, 2006 5:23 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by Near »

If you're not referring to my software, then I have absolutely no idea, that's up to them. But if you are:

Colors are all mixed internally at 16-bits-per-channel. The final output is then reduced to your monitor's color depth. For nearly everyone, that will be 8-bits-per-channel.

Pixel shaders allow the shader to decide between 8-bit (per channel), 10-bit, 12-bit, 16-bit, and single and double-precision floating point. They sometimes sacrifice precision for performance reasons.
User avatar
mikejmoffitt
Posts: 1353
Joined: Sun May 27, 2012 8:43 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by mikejmoffitt »

byuu wrote:If you're not referring to my software, then I have absolutely no idea, that's up to them. But if you are:

Colors are all mixed internally at 16-bits-per-channel. The final output is then reduced to your monitor's color depth. For nearly everyone, that will be 8-bits-per-channel.

Pixel shaders allow the shader to decide between 8-bit (per channel), 10-bit, 12-bit, 16-bit, and single and double-precision floating point. They sometimes sacrifice precision for performance reasons.
I was referring to (most) monitors. I've used some that do it inside 8 bits per channel and introduce banding, which is the source of concern.

Your way of doing it is (to me) the only correct way, doing it with much higher depth then reducing it to the output depth.
User avatar
caramelpuffpuff
Posts: 64
Joined: Sat Feb 23, 2013 4:16 pm

Re: A SNES palette questions/inquiry (possibly silly questio

Post by caramelpuffpuff »

I've been wondering...

Is the SNES palette limited to 13 for EACH sprite? Or 8 colors each 8x8 squares? I am kind of lost on it:

-As 256 is the limited of colors can be shown on SNES,what's the limit of colors each sprite (normal size)? And around 8x8 one sprite (smallest sprite possible)? Some of them seems 12 or 13, while other is 13 different colors on

it, but I got confused, if it's possible to combine the sprite togather, that may use 26 colors, etc.

- So there's no "shaded/grayed" colors at all, all of them are deep hued? The colors that seems brighter than usual is actually television? I may not explain right, but I need to make sure I don't get confused at all.
I am thinking of requesting a tutor [free] to learn NES programming in 6502 Assembly, as I am still baffled on the Bunnyboy 6504 lessons. If anyone want to help, I'm happy.
Bear in mind I may act silly or have trouble understanding, so please bear with me.
Post Reply