Page 1 of 1
Overlay for Company color [Blender]
Posted: 17 Jan 2008 21:21
by Gramble
How can I create overlays for my vehicles I've made in blender. The information in the Sticky topic don't suffice for me, and I'm not able to find any tutorials on this topic.
MfG Thomas
Re: Overlay for Company color [Blender]
Posted: 17 Jan 2008 22:06
by GeekToo
Company colours can be applied to 32 bpp: create a file aaaam.png, where aaaa is the sprite number. The png has to be 8bpp colour indexed. It is used as a mask. Draw the company colours with colour index 196-203 ( The blueish colour on the original OTTD palette)
For an example: download my foster bus, it's mentioned on the 32bpp download list on the wiki
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 13:01
by Wacki
And someday will be 32bpp layer???
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 13:20
by LordAzamath
Wacki wrote:And someday will be 32bpp layer???
mm.. no I think... Dalestan (I think) made a quick calculation once somewhere which showed that the source size would be 64Mb bigger, if 32bpp palette was added... Or something like that.. Not sure though
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 13:38
by Wacki
And it is possible add ONLY 32bpp blue palette, which should be use as company colour layer???
EDIT: or use for this 16bpp palette???
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 17:59
by DaleStan
Palette and "32bpp" are mutually exclusive; the point of a palette is to map a few small numbers (like maybe 256 8-bit numbers, or 16 4-bit numbers) onto an equal count of the much larger 24-bit numbers that most OSen store in their video memories.
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 18:05
by GeekToo
For 32bpp you don't need a palette, that's a typical 8bpp concept. As Lord Azamath said, for 32bpp it would contain something like 16.7 million colours.
Problem in the current 32bpp trunk is that sprite colours are completely replaced by the 8bpp colours in the mask. For the company colours that means only 8 shades of every player colour are available. This is visible next to the 32 bpp colours ( = ugly ).
A much better way would be, I think, to use the 8bpp mask as defined now, and draw the areas in the 32bpp sprites where the company colours must be applied as 32bpp greyscale.
The code can then blend the company colours as defined by the mask( lookup in the 8bpp palette) with the greyscale from the sprite, producing much more colours. This means a change in the code, but I was already thinking about making that change anyway. So I plan to implement this on one of the next revisions of my extra zoom patch.
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 19:03
by Zephyris
Or just 8bpp greyscale for <spriteno>m.png, then use the alpha channel from the 32bpp <spriteno>.png. White or black in <spriteno>m.png could be used as the transparent colour (as these would never be "company colourised").
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 19:58
by Gramble
Please comment on my first try:

- sample_SC72_basic.png (12.02 KiB) Viewed 4910 times
+

- sample_SC72_overlay.png (2.17 KiB) Viewed 4908 times
=

- sample_SC72_overlayed.png (11.21 KiB) Viewed 4914 times
Any ideas what I could do better. I think the company colors are not colorful enough, but if I put the overlay's Alpha up, the material of the basic image is gone.
Re: Overlay for Company color [Blender]
Posted: 18 Jan 2008 22:57
by GeekToo
Zephyris wrote:Or just 8bpp greyscale for <spriteno>m.png, then use the alpha channel from the 32bpp <spriteno>.png. White or black in <spriteno>m.png could be used as the transparent colour (as these would never be "company colourised").
That was about the idea I started with, but I'm afraid it won't work: The code does not use the palette of the mask, only the pixels. The value of the 8bpp pixels in the mask is actually an index to the palette. This palette is hardcoded in the game, or supplied by a newgrf.
What do I mean by an index in the palette: for every sprite the code defines 256 colours, numbered from 0 to 255(the palette). These colours can change according to colour variation or player colour ( so multiple palettes exist ). A pixel in the mask file just points to one of the colours in the palette defined for that sprite. So depending on the player colour or colour variation, the same mask can result in different colours on the screen. The palette of the mask file is completely ignored.
This means that company colours will always have to be defined in the range 196-203, and depending on the player colour (in the palette), this will show a certain colour.
That's why you can't define a greyscale in the mask, but I think it must be done in the 32 bpp sprite. On 32bpp we don't need a transparency colour, the alfa channel is used for that, so that can't be used for anything else.
@ Gramble: nice work, this illustrates the idea I was thinking of very well. Same remark to you: the actual colour cannot be retrieved from the mask, so the company colours must be in the blueish 196-203 pixel index.
I don't know what graphics program you used to overlay the sprite, but the exact method will need some experimenting: on photoshop or gimp, there are multiple blend modes, we will have to find out what works best.
Re: Overlay for Company color [Blender]
Posted: 19 Jan 2008 08:44
by Gramble
I've used GIMP. I copied the blend file and changed the materials to materials without any effects (without shadows etc.). I've only changed the alpha of the material. In Gimp I have just added a new layer to the orginal image with the overlay.
So, I used Gimp just to put these files together.
My only question: Is there any way to create an overlay that does not cover the basic image (shadows etc.) like you can see in the
sticky?
Re: Overlay for Company color [Blender]
Posted: 19 Jan 2008 14:29
by GeekToo
Gramble wrote:I've used GIMP. I copied the blend file and changed the materials to materials without any effects (without shadows etc.). I've only changed the alpha of the material. In Gimp I have just added a new layer to the orginal image with the overlay.
So, I used Gimp just to put these files together.
I did experiment a little in the Gimp: try the following: make the overlay layer alfa app. 70 %. Set the blending mode of the overlay to multiply and not normal: Ctrl-L, mode field. That way the color will be more visible I think. But this will need more experiments to get the best results.
Gramble wrote:
My only question: Is there any way to create an overlay that does not cover the basic image (shadows etc.) like you can see in the
sticky?
The methods for Company Colour described in the sticky were plans for the 32bpp branch, and never implemented as far as I know. But as said before, I will try to implement it in the extra zoom patch.