Bug #4166

paletted 8bpp images are incorrect

Added by Rubidium over 7 years ago. Updated over 7 years ago.

Status:ClosedStart date:2012-08-12
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


I am seeing two issues; the first is the palette not being the right one, the second is related to the colours.

In the ImageJ script you remove entries from the palette, but later you use that reduced set of colours as palette for the PNG. This makes NML bail out because it is an unknown palette. The attached patch solves it for me. It also solves an issue I got with file separators. For me it generated files with a \ in their name instead of putting them in the right directory.

Regarding the colours, as you can see in the screenshot the colours get somewhat messed up for drive through road stops, which are the ones I added the 8bpp mask to. I think you should only use colours where you want some colour change to happen, e.g. in the screenshot you can see a part of the roofs getting the red which seems to be the right behaviour. For the other cases it tries to do some colour conversion, but I don't think you want that there. I fear this requires more experimentation, but I do not really understand your script nor have I ever used blender. I have attached a patch for zbasebuild that allows you to test the mask files yourself with these drive through road stops.

8bpp.diff Magnifier - Patch for zbase (4.12 KB) Rubidium, 2012-08-12 07:50

Pražanice Transport, 2040-05-14.png (627 KB) Rubidium, 2012-08-12 07:50

8bpp_zbasebuild.diff Magnifier - Patch for zbasebuild (6.39 KB) Rubidium, 2012-08-12 07:50

256m_0032.png (1.04 KB) Rubidium, 2012-08-12 08:01

256m_0038.png (1.15 KB) Rubidium, 2012-08-12 08:01

Královské Vítatičky Transport, 2040-07-02.png (471 KB) Rubidium, 2012-08-12 08:01

256m_0038.png (1.59 KB) zephyris, 2012-08-12 11:19

256m_0032.png (1.25 KB) zephyris, 2012-08-12 11:19

Kraletava Transport, 2040-02-23.png (505 KB) Rubidium, 2012-08-12 11:31

Jesburk Transport, 2040-06-06.png (1.03 MB) Rubidium, 2012-08-12 14:21

Associated revisions

Revision 119:dc5bb7631e41
Added by zephyris over 7 years ago

Fix: Updated mask sprites for company colour and bridge recolouring. (Bug #4166)


#1 Updated by Rubidium over 7 years ago

Here I manually modified two of the mask files and with this modification the drive through truck stop looks as in the last image.

#2 Updated by Rubidium over 7 years ago

The recolouring algorithm works by taking the colour from the 8bpp image and using the intensity (saturation?) of the 32bpp image. So for a (company colour) recolour you just need a single colour for the bits that you want to be recoloured. In the images I showed in the previous 'post' you can see I used the same colour in the 8bpp image, but there are different shades of the (recoloured) colour in OpenTTD

#3 Updated by zephyris over 7 years ago

Would these mask sprites be ok? The three different colours are index 198 (dark blue, company colour) and 70 (dark brown, bridge recolour) and 0 (transparent blue).

If I understand correctly then only pixels in the 32bpp sprite which correspond to pixels with a company colour index (i.e. 198) in the 8bpp mask sprite get recoloured for a sprite which has company colour recolouring. Is that right?

#4 Updated by Rubidium over 7 years ago

It is going to recolour using the bridge recolour regardless whether it's a bridge or not. It simply uses the colour of the 8bpp sprite, which for the bridge recolour only changes when it is a bridge. So in this case I would definitely not add the bridge recolour colour to the 8bpp mask sprite.

#5 Updated by zephyris over 7 years ago

Cool, I should be able to get this sorted now.

#6 Updated by zephyris over 7 years ago

I have just committed updated 8bpp sprites for all the stations; let me know if there are any last problems with these.

#7 Updated by Rubidium over 7 years ago

As far as I can see they look okay.

#8 Updated by zephyris over 7 years ago

Excellent :) I shall do a big update of all the mask sprites using my new script.

#9 Updated by zephyris over 7 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Applied in changeset dc5bb7631e41.

Also available in: Atom PDF