Script to convert RGB Images to Mega Drive "format"

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Post Reply
seanonearth
Newbie
Posts: 3
Joined: Fri Aug 02, 2019 2:33 pm

Script to convert RGB Images to Mega Drive "format"

Post by seanonearth » Wed May 15, 2024 10:17 pm

I made these scripts to make producing images (mostly backgrounds) quickly, without having to do something overly simple. It takes an RGB image, and converts it to something that can be reprisented as tiles.

You can set the palette size (16 default), tile size (8 default), and number of tiles (64 default, but you'll often want to change that).

There are two scripts:
  • quantize_image - doesn't reduce palette size. Use this if you want to post process.
  • quantize_3bp - this reduces palette, dithers, and selects colours from the Mega Drive hardware palette. The output is basically good to go


Git hub link - https://github.com/seanbouk/quantizeMD/tree/main - installation instructions on there


Example 1 - forest canopy from above. No tiling in input image
Input - Image

Output showing 64 tiles - Image

Example 2 - forest floor showing mud paths and huts from above:
Input - Image

Output preserves repeating tiles - Image

Example 3 - Render of 3D character
Input - Image

Output showing 1024 tiles - Image

NB - it doesn't make use of flipping tiles. It would probably work better if it did, but I couldn't get it working! Maybe a solution will come to me at some point.

TmEE co.(TM)
Very interested
Posts: 2443
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Re: Script to convert RGB Images to Mega Drive "format"

Post by TmEE co.(TM) » Thu May 16, 2024 12:42 pm

This is impressive, even without flipping ! I imagine the forest example could benefit a lot from that.
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

KanedaFr
Administrateur
Posts: 1150
Joined: Tue Aug 29, 2006 10:56 am
Contact:

Re: Script to convert RGB Images to Mega Drive "format"

Post by KanedaFr » Fri May 17, 2024 10:26 pm

Years ago, I made a HD image converter based on ToyStory trick : tiles on 2 plans, to offer 30 colors (2 pals with 0 index transparent)

Could you tool do the same ? I'll be interested by the result ;)

seanonearth
Newbie
Posts: 3
Joined: Fri Aug 02, 2019 2:33 pm

Re: Script to convert RGB Images to Mega Drive "format"

Post by seanonearth » Sat May 18, 2024 2:57 pm

Yeah, that's a good idea. I think that would be a small additional script to split a 31 colour image into two - 15 for the front and 16 for the back.

I've got some dithering edits I want to make next, but I'll keep it in mind. Ta.

seanonearth
Newbie
Posts: 3
Joined: Fri Aug 02, 2019 2:33 pm

Re: Script to convert RGB Images to Mega Drive "format"

Post by seanonearth » Mon May 20, 2024 11:12 pm

A couple of updates:

I made the dithering changes I wanted.
Image
Horizontal dithering makes horizontal scrolling when you're got a dithered layer over another dithered layer much less flickery (bayer dithering was producing a moiré effect). Maybe also looks like it's moving faster too. Still more testing in anger to do, but it's definitely the effect I was after so I'm happy with the code.

I added vertical style too, and no dithering. And also this...
Image
It's called cluster dot dithering. I'd not heard of it before this! But I took a minute to take a quick search for other dithering patterns I could drop in easily into my existing code, and I quite like it! Seems to work quite nicely for organic images, and it might be a decent start point if the goal is to manually edit the tiles after

I also added a new script called colour_split.py - which takes an image of up to 31 colours, and turns it into two separate images which can be placed on background and foreground

background -
Image

foreground -
Image

combined -
Image

That's 1024 tiles, so almost each tile is unique.

Muzzy
Interested
Posts: 24
Joined: Mon Jun 19, 2017 5:06 pm

Re: Script to convert RGB Images to Mega Drive "format"

Post by Muzzy » Wed May 29, 2024 2:33 pm

Wow! Thats cool!!! :shock: Almost like Toy Story's trick, but less colors. Would be even cooler to get shadow/highlight mode involved to get up to 100+ colors :twisted:
viewtopic.php?f=7&t=3330&start=15#p37939

bioloid
Very interested
Posts: 182
Joined: Fri May 18, 2012 8:22 pm

Re: Script to convert RGB Images to Mega Drive "format"

Post by bioloid » Sat Nov 23, 2024 5:34 pm

Color split option is awesome, thanks

Post Reply