Palette Diferences

Share and discuss all facets of DKC ROM hacking...

Palette Diferences

Postby Cyclone » December 8th, 2024, 11:15 am

I noticed that the RGB values of palettes differ between Mattrizzle and rainbowsprinklez programs. They differ slightly same with the spriters resource and the atlas maps.

Which is the correct palette to go by?

Thanks!
Expedition Leader
Bananas received 559
Posts: 1257
Joined: 2008

Re: Palette Diferences

Postby rainbowsprinklez » December 9th, 2024, 11:15 pm

Cyclone wrote:I noticed that the RGB values of palettes differ between Mattrizzle and rainbowsprinklez programs. They differ slightly same with the spriters resource and the atlas maps.

Which is the correct palette to go by?

Thanks!


What discrepancies do you notice? All my palettes should be directly from the game. Mattrizzle's too.
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby Cyclone » December 10th, 2024, 5:06 am

Here is an example. Notice the green value is different between programs,

Palette_Diferences.png
Expedition Leader
Bananas received 559
Posts: 1257
Joined: 2008

Re: Palette Diferences

Postby rainbowsprinklez » December 10th, 2024, 9:31 am

Cyclone wrote:Here is an example. Notice the green value is different between programs,


tldr; both are correct.

Someone else could expand. I'm not in the mood.
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby Cyclone » December 10th, 2024, 9:39 am

I think its the emulator. I am using the latest ZSNES emulator however I think that's where the problem is cuzz I tried a different version (ZSNES 8MB Custom Build) and the RGB values match with your program. I guess all emulators have filters or differences in rendering,

https://www.romhacking.net/utilities/904/
Expedition Leader
Bananas received 559
Posts: 1257
Joined: 2008

Re: Palette Diferences

Postby rainbowsprinklez » December 10th, 2024, 9:44 am

SNES uses RGB15, instead of RGB24. In RGB24, each color has 8 bits. In RGB15, each color has 5. This misses out on the lower 3 bits of each color. Matt and I display colors in the exact same way. However, the SNES has a special way of displaying colors to try and emulate those lower 3 bits.

From AI:
The RGB15 color format is a 15-bit color representation used by the SNES, GBC, and GBA consoles. It allows for a range of colors by using 5 bits for each of the red, green, and blue color channels. This format is often used in retro gaming and homebrew projects to achieve accurate color representation on these classic systems.

If you're looking to get RGB output from your SNES, you might find it interesting that all original versions of the Super Nintendo and Super Famicom can output RGB without modification, as long as you have the proper cable. The SNES Mini, however, requires a modification to enable RGB output.
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby rainbowsprinklez » December 10th, 2024, 9:45 am

Damn, you explained it for me! :)
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby Kingizor » December 11th, 2024, 12:44 am

5-bits per component has a range of 0-31.
8-bits per component has a range of 0-255.

The simplest way to convert from 5-bit to 8-bit is to multiply each value by 8.

Code: Select all
0 * 8 = 0
1 * 8 = 8
2 * 8 = 16
...

When you get to the higher numbers it doesn't quite scale properly. For example, a 5-bit [31,31,31] would be intended as pure white so [255,255,255], but multiplying 31 by 8 gives [248,248,248].

Some emulators and programs will use different algorithms to try and achieve a nicer distribution of values. This post uses floating point to achieve that.

Code: Select all
for (i = 0; i < 32; i++) {
    spread_1[i] =  i * 8;
    spread_2[i] =  i * 8.225807;
    spread_3[i] = (i * 8) + (i / 4);
}

These are just a few examples, there are a lot of ways to achieve similar results. I don't know what most emulators use, other than ZSNES multiplying by 8. It was actually Qyzbud who pointed that out to me; he was doing all of the maps using ZSNES and I gave him an image with minisculely different colours and he was furious.

I don't imagine the 8MB version of ZSNES would have been changed to alter video output in any meaningful way, so I wonder if there is a setting in the program itself causing that. I recall it having a setting for the old/new graphics engine. The new engine notably had borked offset-per-tile (dizzy level in Yoshi's Island, probably Tetris Attack too), I wouldn't be surprised if it produced slightly different colours than the old engine too.

I'm led to believe that a real SNES has an uneven distribution when outputting colours over RGB, but this isn't something I got around to verifying. Things supposedly get even more complicated when the brightness bits in $2100 are used. I have a very pretty test ROM for this stuff from a few years back, but we all get inadvertently sidetracked for years at a time, don't we?

rainbowsprinklez wrote:...

Yes, it answered questions to which we already knew the answers and not even things we cared to know. It's typical of an AI to produce a wall of irrelevant, boring text when someone asks it a question. A real person wouldn't do that and I certainly wouldn't do that either...wait... :facepalm:
Trailblazer
Bananas received 77
Posts: 249
Joined: 2010

Re: Palette Diferences

Postby Cyclone » December 11th, 2024, 6:17 am

Kingizor wrote:These are just a few examples, there are a lot of ways to achieve similar results. I don't know what most emulators use, other than ZSNES multiplying by 8. It was actually Qyzbud who pointed that out to me; he was doing all of the maps using ZSNES and I gave him an image with minisculely different colours and he was furious.


Exactly. I have to go through all my palettes and check them. A lot work. I was practically finished my program too!

I still don't know... Which is the correct palette reference to go by?


ZSNES version 1.51 won't work on my computer... I'm using version 1.42 which is giving me different results...
Version zsnesw151-FuSoYa-8MB_R2 gives me matching results when I compare things with rainbow's and Matt's program.

Here is a screen shot of the video settings for version 1.42....
UN-checking "New GFX Engine" gave me different results but still doesn't match.

pallette differences.png
pallette differences.png (35.58 KiB) Viewed 184 times



Thanks Kingizor for your explanations. :thumbs:
Expedition Leader
Bananas received 559
Posts: 1257
Joined: 2008

Re: Palette Diferences

Postby rainbowsprinklez » December 11th, 2024, 6:36 am

Kingizor wrote:
rainbowsprinklez wrote:...

Yes, it answered questions to which we already knew the answers and not even things we cared to know. It's typical of an AI to produce a wall of irrelevant, boring text when someone asks it a question. A real person wouldn't do that and I certainly wouldn't do that either...wait... :facepalm:


Thanks Kingizor, for a wall of text as usual... something tells me you like teaching...

I just multiply by 8. To me, this is the most accurate. I'm just shifting bits, not adding new data like emulators do.
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby rainbowsprinklez » December 11th, 2024, 6:49 am

BSNES, the most accurate emu there is, show 248,248,248 as 255,255,255. Matt and my program aren't wrong though. We use literally what the game tells us. It's the SNES system that changes.

Image
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby rainbowsprinklez » December 11th, 2024, 6:52 am

Cyclone wrote:I still don't know... Which is the correct palette reference to go by?


You are still misunderstanding. They are ALL correct. None is "wrong"

Cyclone wrote:Exactly. I have to go through all my palettes and check them. A lot work. I was practically finished my program too!

You shouldn't have to. the palettes are correct.

If you want to alter the game data in some way, don't waste time manually converting it. You are a programmer. Find a way to do it that isn't manual. For example, the SNES mutates those values with the same exact input. I would find that formula and use it to automate. What could be more accurate than what's in the game?
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016

Re: Palette Diferences

Postby rainbowsprinklez » Today, 2:28 am

Are we on the same page now?
Veteran Venturer
Bananas received 110
Posts: 605
Joined: 2016


Return to ROM Hacking

Who is online

Users browsing this forum: No registered users and 5 guests