Jump to content

New community dev tool uploaded: Vera Graphics Converter


Recommended Posts

Vera Graphics Converter

View File

Version 0.1

This software converts indexed and RGBA images in the formats PNG, JPG or GIF into binary data suitable for the VERA chip in the upcoming 8-Bit Computer Commander X16.

Basic usage:

Open an image file using File/Open...

Configure the settings according to your needs.

Export the image using File/Export Bitmap/Tiles/Sprites...

Image Modes:

You can open either an indexed image with an embedded palette or a regular RGBA image.

Depending on the image mode, the software behaves slightly differently.

RGBA:

In RGBA mode, VGC needs to match the pixel colors to the colors in the palette. This can be done by comparing color similarity in RGB (Red, Green, Blue), HSL (Hue, Saturation, Lightness) or HSV (Hue, Saturation, Brightness) mode. Select the conversion strategy that works best for your image. Ideally load a palette that matches all colors in the image.

You can specify the bit depth of the image by changing the pixel mode. 1 Bit per Pixel results in 2 colors, 2 Bits per Pixel result in 4 colors, 4 Bits per Pixel result in 16 colors and 8 Bits per Pixel uses the whole palette of 256 colors.

The colors usable by the image depend on the palette offset.

Indexed:

In indexed mode VGC assumes that all pixels in the image have the correct index. It is still necessary to select the correct palette offset to give a correct export. On export the palette offset is subtracted and the index value capped on the selected pixel mode.

Transparency

Any pixel in the image that has an alpha value of 255 is set to the index selected in "Transparent Color Index". The minimum value is the palette offset.

Image Mode:

The VERA Graphic chip has three modes. Bitmap, tiled with a tile dimension of 8 * 8 pixels and tiled with a tile dimension of 16 * 16 pixels. Both tile modes split the image in separate tiles and limit their number to 256, since the VERA chip cannot address more than 256 tiles. It is also possible to limit their number even further.

To use a tile mode the width and height of your image must be divisible by 8 or 16.

The VERA chips supports 4 different resolutions: 640x480, 320x480, 640x240 and 320x240. VGC does not enforce these resolutions.

It is also possible to generate sprite maps. In sprite mode the tiles can have 8, 16, 32 or 64 pixels in width or height. They are however limited to 128 tiles, and similarly, the source images dimensions have to be divisible by the tile dimensions. Sprites can only have a color depth of 4 or 8 Bits per Pixel.

PRG File Header

It is possible to save the exported binary file with 2 leading bytes. This is necessary for some load routines in the Commander X16 Kernal.

Splitting files

The exported files can be saved in chunks of a given size. The VERA Video RAM is paged in pages of 2048 bytes. Files can be split at any page, depending on how you want to store or load your data. The PRG File Header is saved to every individual file.

The Palette

You can load and save the color palette in the Format used by the Gnu Image Manipulation Program (GIMP)

Other software like Aseprite can read and save this format too.

You can also export the palette in the format used by the VERA chip. The PRG Header option is applied to this as well. The file splitting is not.

Analyzing the image.

You can double click on colors in the palette to change them.

When you hold the left mouse button on a color in the palette, the parts of the image using this color are highlighted.

Similarly, when you click on the image the color in the palette is also highlighted.

 


 

  • Like 3
  • Thanks 2
Link to comment
Share on other sites

I've been working on this for a couple of weeks now. What I originally intented to do is a tool that crunshes images with repeating patterns into a set of tiles and autogenerates a tilemap. Sort of what Ron Gilbert and Gary Winnick did in Maniac Mansion, but with enhanced features like flipping tiles and shifting the color palette. Befor I could have that I need a Tileeditor, and before I can create a Tileeditor I need this. So, this is the first version of what I hope will be a very versatile tool to create assets optimized for the VERA chip.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Looks very nice! I'll definitely be trying this out for myself.

I was working on a similar tool, but mine looks incredibly ghetto because UI really isn't my thing. Also, I wound up getting lost in the weeds of editing both tiles and tilemaps, because I wanted to merge multiple similar tiles together. That level of built-in editing turned into a giant headache.

(My test case was a giant star field with nebulae, so of course I had all 16 distinct combinations of "a single 1-pixel star in the 8x8 tile" represented, times every possible star color, times every possible background nebula color. I needed to chew on a less ambitious image.)

  • Thanks 1
Link to comment
Share on other sites

Oh, by the by:

Quote

since the VERA chip cannot address more than 256 tiles.

This is not true. Well, okay, this is partially true. True if and only if you are using 1bpp tile modes (a.k.a. "text" modes). Other tiled modes (2, 4, and 8bpp) support up to 1024 tiles.

See also:
https://github.com/commanderx16/x16-docs/blob/master/VERA Programmer's Reference.md#tile-mode-248-bpp

Edited by StephenHorn
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

Feature suggestions:

When I'm looking at the converted version of a set of tiles, the display defaults to using the 0 offset in the palette. You can click a tile and change this per-tile, which is great, but if you want to change several of them this way, then it is tedious when you could just select several tiles and change the value once for all of them.

Also, when doing a sprite sheet, it would be nice if you could re-arrange the order of the individual sprite blocks and/or omit some from the export. (I'm working with an animation that was clearly designed to be multi-sprite, and the sheet ends up having the frames of each "sub-sprite" interlaced with each other when it would be nice to re-arrange them w/o having to edit the source image.

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...

The master branch on github already has a patch for the crash. I will provide new binaries when I find the time to work on this again. In the meantime, the crash can be avoided by opening the settings dialog before exporting.

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use