Colour Depth & Zoom Level: Know the Facts

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

Post Reply
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Colour Depth & Zoom Level: Know the Facts

Post by Gwyd »

So in the last couple of weeks especially I've seen a lot of people not know the difference between extra zoom and 32bpp. This has frustrated me, so through the next couple of posts I shall explain.

Colour Depth
OpenTTD has 2 colour palettes built in, which were designed to have a variety of colours, for all applications: DOS and WIN. There are 256 colours, hence 8bpp (8 binary bits can make 256 numbers). It has animated colours for fire, flashing lights and company colours built in.
There is another option for GRF developers, which is 32bpp: this allows use of all colours, as well as allowing for use of alpha transparency. However, animated or company colours have to be coded especially. Most GRFs use the game's DOS palette, but there are lots that use 32bpp. This can be independent of zoom level.

Zoom Level
OpenTTD supports 7 zoom levels: 3 outward zoom levels (8x, 4x, 2x), one normal and 2 inward zoom levels (2x, 4x). This is literally the size of the sprites: on normal zoom the length of an 8 length rail vehicle is 32 pixels, going up to 64 on 2x zoom and 128 on 4x zoom. Unless you're pikkabird :wink:. OpenGFX and most GRFs are made in normal zoom, and I'm almost certain there's no GRFs with outward zoom levels however there are quite a few GRFs with inward zoom levels. This can be independent of colour depth.

Image

Top left: normal zoom, using 8bpp DOS palette
Top right: normal zoom, using 32bpp
Bottom left: 4x zoom, using 8bpp DOS palette
Bottom right: 4x zoom, using 32bpp
If I worked on these properly, these could all be coded into the game and work as listed above.
Basic message: 32bpp ≠ extra zoom
Edit: thanks Pyro, I forgot to mention that
Last edited by Gwyd on 11 May 2018 16:55, edited 1 time in total.
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Colour Depth & Zoom Level: Know the Facts

Post by Gwyd »

What does this mean for GRF devs? Whats the benefit of each?
Well, I briefly looked at this in my previous post, but this is how it applies in GRF development.
Disclaimer: this is how it works for NML, m4NFO and NFO may well be different
8bpp normal zoom sprites are the only sprites that are defined as sprites. 32bpp sprites and extra zoom sprites are defined as alternative sprites. The game with default settings will always prioritise sprites with the correct zoom for the viewpoint and 32bpp over 8bpp, unless the blitter is changed.
The practicalities of using extra zoom sprites are:
Much bigger file sizes (this usually doesn't matter)
Different alignments. There's a good guide to working this out https://newgrf-specs.tt-wiki.net/wiki/N ... zoom_level
The practicalities of using 32bpp sprites are:
The file does not need to be palettised
The "transparent" blue is not used: acutal alpha is
Each company colour has it's own sprite or mask, so is coded differently to 8bpp cc
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: Colour Depth & Zoom Level: Know the Facts

Post by Pyoro »

Well, don't know how crucial this really is, but if we're talking about it -
https://newgrf-specs.tt-wiki.net/wiki/P ... oordinates
There's a DOS and a Windows palette. While I never counted, most GRFs probably use the DOS palette, which seems perhaps counter-intuitive.
User avatar
Gwyd
Chief Executive
Chief Executive
Posts: 721
Joined: 17 Apr 2017 16:52
Location: Western Ile-de-France Region

Re: Colour Depth & Zoom Level: Know the Facts

Post by Gwyd »

The final post: my opinion. You can ignore this one.
Colour depth
Personally, I prefer to use 8bpp: it's easier for styles to fit with each other, since they are using the same shades and I don't have to think up colours and get it wrong. Additionally company colours is much easier. Also having to mess about with alpha, for me, can just become tiresome. I still use 32bpp occasionally for when I need transparency, or better colour definition, but that's quite rare.
Extra Zoom
I just don't like this. I don't know why really. To me it contrasts harshly with the original style of the game. Also since it's hardly easy to draw that many pixels (at 4x zoom, anyway) people tend to render these with 3D models. I feel that a lot of the time, this leaves the sprites lacking character, and having large swathes of the same colour. This is however improving, so we'll see. I very much doubt I'll ever use extra zoom.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Colour Depth & Zoom Level: Know the Facts

Post by wallyweb »

Gwyd wrote:It has animated colours for fire, flashing lights and company colours built in.
and water, and some brown shades used, I think, by one of the default industries . :D
User avatar
Napoleon9th
Engineer
Engineer
Posts: 6
Joined: 20 May 2007 14:39
Location: Bucharest, Romania

Re: Colour Depth & Zoom Level: Know the Facts

Post by Napoleon9th »

Gwyd wrote: 11 May 2018 16:36 OpenTTD supports 7 zoom levels: 3 outward zoom levels (8x, 4x, 2x), one normal and 2 inward zoom levels (2x, 4x).
Am i missing something, or was that a typo? I count only 6 levels, 3+1+2. :-B
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: No registered users and 23 guests