Sonic and Sega Retro Message Board: Indexed colour palette Image - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

Indexed colour palette Image does anyone have one of mega drive colours?

#1 User is offline Linaru 

Posted 24 November 2015 - 11:29 AM

  • Posts: 22
  • Joined: 26-October 15
  • Gender:Female
  • Location:Southampster
Does anyone have an Indexed colour image of the mega drives colour palette?

I noticed that when SonLVL exports colour palettes it saves them as indexed colour images and can import indexed colour images too..
unfortunately it does not seem to save the full range mega drive colours.

an indexed image would be really useful for me to convert all of my pixel arts colour palettes as accurately as possible.


for those who don't know a indexed colour image is a a form of limited colour image file. when editing it it can only draw in a limited selection of colours
but I am not used to using this format in Photoshop as my pixel art is usually in a different format



I did try taking an image of all available mega-drive colours making it indexed and importing a megadrive.ACO but for some reason half the colours I should have been able to use were not available
This post has been edited by Linaru: 24 November 2015 - 11:33 AM

#2 User is offline GerbilSoft 

Posted 24 November 2015 - 11:37 AM

  • RickRotate'd.
  • Posts: 2838
  • Joined: 11-January 03
  • Gender:Male
  • Location:USA
  • Project:Gens/GS
  • Wiki edits:5,000 + one spin
Mega Drive uses 9-bit color values, resulting in a total of 512 colors. Indexed color images typically use 8-bit values (256).

That'd be why you're only seeing half of the possible colors.

#3 User is offline Linaru 

Posted 24 November 2015 - 11:46 AM

  • Posts: 22
  • Joined: 26-October 15
  • Gender:Female
  • Location:Southampster

View PostGerbilSoft, on 24 November 2015 - 11:37 AM, said:

Mega Drive uses 9-bit color values, resulting in a total of 512 colors. Indexed color images typically use 8-bit values (256).

That'd be why you're only seeing half of the possible colors.


I see perhaps I have Mis-understood this, I was hoping to create an indexed file in Photoshop using all of the mega-drives colours so that any image I transferred over to it would be automatically converted.
this would give me an environment where I could better select the colour and adjust the sprites shading.


the colour palette I have been using to develop all the art for a hack may not have been compatible:
Posted Image

its a great selection of colours.. looks really pretty in photoshop..

#4 User is offline Shadow Hog 

Posted 24 November 2015 - 12:29 PM

  • "I'm a superdog!"
  • Posts: 4341
  • Joined: 05-November 06
  • Gender:Male
  • Location:Earth
  • Wiki edits:10
You are not going to be able to make an indexed file in Photoshop that contains all of the Genesis's colors, because it has a set of 512 colors and Photoshop's indexed mode only supports 256. No matter how you slice that, you would be losing data.

Best you can do is have an image on-hand that contains all 512 colors, like this:

Posted Image

#5 User is offline Linaru 

Posted 24 November 2015 - 12:44 PM

  • Posts: 22
  • Joined: 26-October 15
  • Gender:Female
  • Location:Southampster
I have learnt an interesting trick while trying to work this out.
when I was trying to create an indexed image I was using a .ACO file.. a palette containing a bunch of megadrive colours
apparently when I tried to import the indexed image created with that into son level it ignores the image and loads each of the colours in the pallet in order..

I tried making an indexed image set up to use the colours of my colour pallet.. as its colour index and when I imported it, sonLVL imported my colour palette near perfectly..

only one or two colours are off ever so slightly, presumable because they are not mega-drive colours.

#6 User is offline MainMemory 

Posted 24 November 2015 - 12:56 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 4214
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
Another problem with MD colors is that different programs have different methods of converting the 9-bit values to 24-bit RGB, so colors may be darker or lighter depending on what you're using. If you want to ensure that the colors in your palette are directly matching MD colors in SonLVL, you can either save and reload the level if you import a palette from an image or enter 24-bit RGB values, or use the number boxes on the left side to change the colors.

#7 User is offline Linaru 

Posted 24 November 2015 - 01:10 PM

  • Posts: 22
  • Joined: 26-October 15
  • Gender:Female
  • Location:Southampster

View PostMainMemory, on 24 November 2015 - 12:56 PM, said:

Another problem with MD colors is that different programs have different methods of converting the 9-bit values to 24-bit RGB, so colors may be darker or lighter depending on what you're using. If you want to ensure that the colors in your palette are directly matching MD colors in SonLVL, you can either save and reload the level if you import a palette from an image or enter 24-bit RGB values, or use the number boxes on the left side to change the colors.


ah, well my problems been solved by that SonLVL update it seems. got all the colours into the palette at the exact values by importing from a png.

#8 User is offline KingofHarts 

Posted 26 November 2015 - 07:32 PM

  • Posts: 1610
  • Joined: 07-August 10
  • Gender:Male
  • Project:Project Sonic 8x16
  • Wiki edits:1

View PostShadow Hog, on 24 November 2015 - 12:29 PM, said:

You are not going to be able to make an indexed file in Photoshop that contains all of the Genesis's colors, because it has a set of 512 colors and Photoshop's indexed mode only supports 256. No matter how you slice that, you would be losing data.

Best you can do is have an image on-hand that contains all 512 colors, like this:

Posted Image


I've been looking for a way to make 512 colors take up less space... I'm gonna reappropriate this image for Triad if you don't mind




#9 User is online nineko 

Posted 26 November 2015 - 08:48 PM

  • I am the Holy Cat
  • Posts: 5648
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
For reference, on Sega Retro.

I forgot where I got the MD and the MS palettes, probably from the 1536 colors demo (the former) and from some doc on smspower (the latter). I created the GG palette from scratch with a small program I wrote, instead.

Back to the original topic, I'm not sure why you'd want more than 61 colors in your palette file, since you can't really display more colors than that on a Mega Drive without using black magic, not to mention that each 8×8 tile is furtherly limited to a single palette line.

#10 User is offline Korama 

Posted 27 November 2015 - 07:31 PM

  • Posts: 272
  • Joined: 18-May 04

View PostMainMemory, on 24 November 2015 - 12:56 PM, said:

Another problem with MD colors is that different programs have different methods of converting the 9-bit values to 24-bit RGB, so colors may be darker or lighter depending on what you're using.

That's true many old programs were lazy and simply bit-shifted the MD color component values once. An 0xE (hexadecimal) shifted 4 bits to the left (same as multiplication by 16) equals 0xE0, or 224 decimal. Add/Or the original value, as shown in nineko's link, and you get 0xEE (238).
However, that method is wrong. Because that way, pure white on the MD (0xEEE) would not map to pure white in 24-bit RGB (255, 255, 255).
The mathematically correct conversion formula is obviously RGB = 255/7 * (MD / 2).
That is, one step on the MD side equals 255/7 = 36.428571... steps on the 24-bit RGB side.
If you're worried about performance, instead of having to do floating point math for this, you could just as well precompute a lookup table - there are only 8 possible values on the MD side, after all.

Or you could use this little known trick (which is the reason why I'm writing all this):
To mathematically extend a value of size N bits to a value of size M bits (M > N), just repeat/duplicate the N bits over and over until all M bits are filled.
Example: let's take an MD component value of 0xC, which is actually a value of six (0xC shifted one bit to the right, or divided by 2). MD components are 3 bit, and six in binary is 110.
Let's extend those 3 bits to 8 bits by repeating:
11011011 = 0xDB = 219.
Test: 255/7 * 6 = 218.57... rounded = 219. :)

In C notation, that operation would be x << 5 | x << 2 | x >> 1.

PS: people have measured the voltage levels that the MD VDP outputs in order to get the "correct" values. They are slightly different, but I'd say it doesn't matter much, because the actual colors you'll end up seeing also greatly depend on your screen and its settings.
This post has been edited by Korama: 27 November 2015 - 07:34 PM

#11 User is offline MainMemory 

Posted 27 November 2015 - 10:53 PM

  • Every day's the same old thing... Same place, different day...
  • Posts: 4214
  • Joined: 14-August 09
  • Gender:Not Telling
  • Project:SonLVL
  • Wiki edits:1,339
I once made a topic about this very issue, though at the time we somehow came to the conclusion that 0xEE was correct. SonLVL currently uses a precomputed table in MD mode. Oddly enough, S&KC doesn't mask off the low bit of each component, meaning you have 12-bit colors instead of the proper 9 bits.

#12 User is offline rata 

Posted 07 December 2015 - 03:31 PM

  • Posts: 452
  • Joined: 11-January 15
  • Gender:Male
  • Location:Argentina
  • Project:Trying to be useful somehow.

View Postnineko, on 26 November 2015 - 08:48 PM, said:

For reference, on Sega Retro.

I forgot where I got the MD and the MS palettes, probably from the 1536 colors demo (the former) and from some doc on smspower (the latter). I created the GG palette from scratch with a small program I wrote, instead.

Back to the original topic, I'm not sure why you'd want more than 61 colors in your palette file, since you can't really display more colors than that on a Mega Drive without using black magic, not to mention that each 8×8 tile is furtherly limited to a single palette line.


I wonder why Puggsy's developers lied us in such a big way...
Posted Image


Can 68k make software scaling, or is it just another lie?

#13 User is offline amphobius 

Posted 07 December 2015 - 03:36 PM

  • where are the japanese shaman girls, lintahlo?
  • Posts: 2120
  • Joined: 19-February 08
  • Gender:Male
  • Location:Northern Ireland, Belfast
  • Project:life
  • Wiki edits:165
It's not 'lying', because things like sprite rotation and scaling can be done in software if you're clever enough. It's also possible to use that many colours on screen with 'black magic' as nineko said - the Puggsy devs were pretty smart.

#14 User is offline rata 

Posted 07 December 2015 - 06:30 PM

  • Posts: 452
  • Joined: 11-January 15
  • Gender:Male
  • Location:Argentina
  • Project:Trying to be useful somehow.
Well, my only actual doubt was the colour count, since we all know that 32x does software rotation and scaling. I guess that 32bit or 16 bit only matters in how much effort will you have to put to do it then. But with 'black magic' I took that it was just not possible. I will take random screenshots in the game to see if I can count more than 61 colours.I imagine that it would be something very resouce demanding, right? I mean, no chance to see something like this in a sonic hack then?

#15 User is online nineko 

Posted 07 December 2015 - 08:43 PM

  • I am the Holy Cat
  • Posts: 5648
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Sonic games already show more than 61 colors in the water levels. You can change any palette entry at the middle of the screen, though it has to be done carefully to prevent snow from appearing around the picture. This is as much as I can explain without getting too technical, unless you know what an H-int is.

  • 2 Pages +
  • 1
  • 2
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users