gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Small problem with git

#146681 - KaioShin - Fri Dec 07, 2007 3:53 pm

Hi all. I wonder if someone could assist me with a problem I've with git.

Take a look at the following image please:

[Images not permitted - Click here to view it]

The image I want to display was converted to tiles and tilemap with git.

However, as you can see in the end of the very first line it ignored the visible area and so the whole picture is shifted apart by 2 tiles. The last 2 tiles on row 1 should have started at row 2. The error continues in each line of course.

I'm sure the problem lies in my usage of the paramters. There are so many, and I'm no graphics expert, so I'm not sure what I should change.

My command string was:

git test.bmp -gB4 -mRtpf -ftb -ma0

Can anyone help me solve my problem?

Thanks.

#146686 - Cearn - Fri Dec 07, 2007 5:39 pm

A screen-block is 32 tiles wide, but the GBA screen is 240 pixels = 30 tiles wide. I'm guessing your bitmap is 240 pixels wide as well. git (which is now known as grit) doesn't pad to 32-tile boundaries unless you tell it to, so the output map will be 30 tiles wide as well, which results in the two tile misalignment when you feed it directly into a screen-blocks.

Possible solutions: pad the original bitmap, tell g(r)it to pad using `-aw 256' or export to screen-block layout with `-mLs':

#148670 - KaioShin - Tue Jan 08, 2008 6:36 pm

The tiles and tilemap worked perfectly now :)

But somehow I can't get palettes to work right at all :(

Source Image:
[Images not permitted - Click here to view it]

As it appears after conversion:

[Images not permitted - Click here to view it]

I tried a variety of options for grit. Nothing worked. Can someone help me with this?

#148673 - Cearn - Tue Jan 08, 2008 7:21 pm

Notice the pattern of wrongness here: the places where the colors seem to change are tile boundaries. This usually indicates that you have a 4bpp background, but have tiles that use colors from multiple 16-color palettes.
If, for example, a tile uses colors 0x11 and 0x21, it will take color 1 from palette 1 (or 2), but not both. Look the how the colors are arranged in the palette to see if this is the case.

To solve this, either use 8bpp output and disable tile-palette reduction (the `p' in `-mRtpf'. For your convenience, you can also use `-mR4' and `-mR8' as aliases for `-mRtpf' and `-mRtf', respectively. Alternatively, you can rearrange the colors in the palette of the original image so that the tiles don't access multiple sub-palettes.

#148693 - KaioShin - Tue Jan 08, 2008 11:24 pm

Thank you, I'll try your suggestions :)