Page 27 of 38

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 07 Feb 2010 20:44
by maquinista
GeekToo wrote:
Zephyris wrote:How does 2CC work with the extra zoom level method of CC recolouring? If a 2CC palette index is in the mask image does it get recoloured correctly?
Yes, if it is in the mask image, and the palette is correctly filled in, it will lookup the 8bpp colour index and translate it to 32bpp. Haven't tried though if this works in practice.

Cmoiramain: added to my personal list of items to solve.
I have added the CC mask for some livestock wagons and It works:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 08 Feb 2010 09:14
by neob
maquinista wrote:The feature that allows station tiles with two or more ground sprites is awesome.
a lot of potential :)

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 11 Feb 2010 09:29
by peter2
thanks for the binnaries great patch gives me a new interest in the game :bow:

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 17:58
by Zephyris
So, what have I done wrong?
Screenshot1.png
Screenshot1.png (298.38 KiB) Viewed 4371 times
(I am referring to the lack of shading on the CC and 2CC, not the messed up offsets)

Using the x64 version posted here.
An example sprite and mask are attached.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 18:32
by maquinista
The CC mask are good, They are in indexed mode and They have the correct values.
Try to take another screenshot with less saturation. Open the view port, and hold the 3 key two or three seconds, and press CTRL + R.

The problem could be caused by the CC algorithm. It's experimental and It could have some improvements.
IMHO the algorithm shouldn't increase the original saturation of the pixels. It should be allowed only to decrease it.

I could try to modify the CC algorithm, but I don't know where the saturation is modified.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 19:04
by Zephyris
maquinista wrote:Open the view port, and hold the 3 key two or three seconds, and press CTRL + R.
Ummm, This doesn't seem to do anything... I tried it in the main viewport and an extra viewport.
maquinista wrote:IMHO the algorithm shouldn't increase the original saturation of the pixels. It should be allowed only to decrease it.
Having helped write the algorithm I think I can help here! The algorithm can't calculate the saturation of a pixel in the sprite (easily) without knowing the hue of that pixel, and there is no standard hue used across original sprites for CC regions. Therefore the algorithm simply ignores the hue and saturation data of the original sprite and only uses the pixel brightness for the CC calculation. It should never give the result I am seeing as there is definately an underlying variation in brightness.
maquinista wrote:I could try to modify the CC algorithm, but I don't know where the saturation is modified.
As I understand it the saturation is stored in the presets for company colours, so this would be the place to change it.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 19:23
by Zephyris
Does this give some hint to the problem? It looks to me that the CC algorithm isn't running at all for some reason; I would expect the company colour schemes to look different (ie. no difference between red/pink etc). If the new CC algorithm isn't running that would explain why the lorry sprite CC is being recoloured to flat CC (the colour on the mask sprite) instead of being calculated properly...

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 19:27
by maquinista
Zephyris wrote:
maquinista wrote:Open the view port, and hold the 3 key two or three seconds, and press CTRL + R.
Having helped write the algorithm I think I can help here! The algorithm can't calculate the saturation of a pixel in the sprite (easily) without knowing the hue of that pixel, and there is no standard hue used across original sprites for CC regions. Therefore the algorithm simply ignores the hue and saturation data of the original sprite and only uses the pixel brightness for the CC calculation. It should never give the result I am seeing as there is definately an underlying variation in brightness.
The saturation (or chroma) is the difference between the highest RGB value and the lower value. It can be calculated easily from original colours.

http://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 19:39
by Zephyris
maquinista wrote:The saturation (or chroma) is the difference between the highest RGB value and the lower value. It can be calculated easily from original colours.
Apologies, you are totally right. I had another look over the code and the info taken from the sprite is the saturation and the brightness, only hue is ignored. The company colour is produced by adjusting the saturation and hue, and if I understand the CC presets right then the saturation modifications are either nil or less saturated.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 20:09
by GeekToo
Looking at the purple letters, I'd say you started the 32bpp-simple, iso of 32bpp-optimized blitter. And then you have the original sprite masking. Zooming out probably looks funny too.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 12 Feb 2010 20:13
by Zephyris
GeekToo wrote:Looking at the purple letters, I'd say you started the 32bpp-simple, iso of 32bpp-optimized blitter. And then you have the original sprite masking.
Aaaah, thankyou :)

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 20 Feb 2010 18:58
by GeekToo
Update:
-sync to trunk
+
-force to always use the 32bpp-optimized blitter
-better catenary drawing order
-solved some problems with track fence drawing
-minor fixes

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 21 Feb 2010 13:46
by neob
binaries

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 21 Feb 2010 14:04
by petert
neob wrote:binaries
Try to upload the correct diff file, for 19167, as I see you've upload GeekToo's diff.

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 21 Feb 2010 14:17
by neob
i applied his 19167 diff on the trunk which was 19180, no conflicts, no errors.
is that a problem?

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 21 Feb 2010 15:57
by NekoMaster
neob wrote:i applied his 19167 diff on the trunk which was 19180, no conflicts, no errors.
is that a problem?
Probably not, but try testing everything just to make sure

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 21 Feb 2010 16:43
by petert
neob wrote:i applied his 19167 diff on the trunk which was 19180, no conflicts, no errors.
is that a problem?
No, just provide the new diff. Even when there aren't conflicts, there are usually some offsets.
NekoMaster wrote:Probably not, but try testing everything just to make sure
What else should neob have tested, exactly?

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 23 Feb 2010 23:22
by Antonio1984
GeekToo wrote:Update:
-sync to trunk
+
-force to always use the 32bpp-optimized blitter
-better catenary drawing order
-solved some problems with track fence drawing
-minor fixes
thanks GeekToo for the patch, and thanks neob for the various binaries!

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 26 Feb 2010 20:16
by neob
a quick question regarding the scale algorithm, if there a z2(32bpp in normal zoom) sprite presented but no z0 (fullzoom)
which sprite will the algorithm scale the z2 or the 8bpp ?

---
p.s. Antonio1984, thanks but its 'GeekToo' who does all the heavy lifting :)

Re: [32bpp] Extra zoom levels, experimental new CC algorithm

Posted: 26 Feb 2010 20:22
by GeekToo
the 8bpp for zoom in, the 32bpp for zoomout