The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Ranran(retired) on January 12, 2019, 01:14:21 PM

Title: Alpha channel drawing bug on the dialog window
Post by: Ranran(retired) on January 12, 2019, 01:14:21 PM
1. Nighttime drawing only affects pixels with alpha channel on the dialog window.
The nighttime effect should be unnecessary on the dialog window.
I mean, on the dialog window, pixels that are not transparent will not get dark but only pixels with alpha channels will get dark in the night.

This occurs with both standard and extended.
(Currently there are few pak files with transparent pixels but I think that this will increase in the future mainly rendered by 3D modeling.)


2. Alpha channel reversal phenomenon on the dialog window.


The black contamination rate during this night is inversely proportional to the transmittance.
(I suppose this may be other than the grayscale color.)
Roughly speaking, 99% black is mixed in pixel with a transmittance of 1%, and 1% black is mixed in pixel with a transmittance of 99%.

This seems to distinguish between 0 and null (when makeobj creates a pak file), if it is perceived as transmittance 0%, the pixel may become completely black at night.


The result of replacing the icon with an image with an alpha channel in pak192.comic.
(https://i.imgur.com/Sk3h1Sc.gif)


(https://i.imgur.com/66wuvpa.gif)

(https://i.imgur.com/uOQTpJO.gif)
It is the same in every dialog window, such as line managemant screen and convoi list, not only in depot.
Title: Re: Alpha channel drawing bug on the dialog window
Post by: Leartin on January 12, 2019, 01:59:40 PM
I can confirm, semi-transparent pixels get darkened while keeping their transparency. Despite using a lot of transparency these days, it's mostly black shadows, which are unaffected by this problem (they can't get darker).

About the "reversal": I'm not entirely sure what you mean. Since the pixel changes color, the black is more visible the more visible the pixel is.

Title: Re: Alpha channel drawing bug on the dialog window
Post by: Ranran(retired) on January 12, 2019, 03:11:39 PM
Sorry. I am not good at English, so it may not express well what I want to say.

I think that behavior is different between achromatic color and color. It will be broken if it has a color.

Please check this comparison image.
(https://i.imgur.com/416fpCe.png)
Below are in the nighttime.
You can see that the center of snail shells and the center of red symbols are abnormally black.
The lower the transparency, the more black it looks.

This is the original image (https://forum.simutrans.com/index.php?action=dlattach;topic=18529.0;attach=27500).
Please check the black pixels.
It can not be distinguished from surrounding color.
Does it look like it is transparent? At least makeobj decided that pixel is transparent. (Close to 0%).
It is my mistake that mixed unnecessary alpha channels.
I could do the same as other pixels by completely removing the alpha channel from that pixel.
Even if I look at other pixels, I do not think that it keeps the transmittance normally at night.
The lower the transparency, the darker it is.
Title: Re: Alpha channel drawing bug on the dialog window
Post by: Leartin on January 12, 2019, 04:27:36 PM

Quote from: Ranran on January 12, 2019, 03:11:39 PMDoes it look like it is transparent?
Yes, all pixels that do turn black are semitransparent. I checked your sources, it is only 1% transparent, very hard to see, but a tool can read the values.
Quote from: Ranran on January 12, 2019, 03:11:39 PMYou can see that the center of snail shells and the center of red symbols are abnormally black.
The lower the transparency, the more black it looks.
Yes. What was red in the sign turns black. It keeps transparency and mixes with the background. So very transparent pixels will be light gray, less transparent pixels will be dark gray. And a 99% visible pixel will be 99% black.
Title: Re: Alpha channel drawing bug on the dialog window
Post by: Dwachs on January 12, 2019, 06:53:59 PM
The parameter 'do not draw night colors' is used by the gui code, but it is not propagated down to the pixel copy routines, which use night colors on transparent pixels.
Title: Re: Alpha channel drawing bug on the dialog window
Post by: prissi on January 13, 2019, 01:54:34 PM
Since transparency does work as expected on already darkened pixels in the display, I would suggest to no darken any transparent pixel at all. What do you think?
Title: Re: Alpha channel drawing bug on the dialog window
Post by: Ranran(retired) on May 02, 2021, 02:28:07 PM
I have to dig up an old thread.
Unfortunately, this problem is now manifesting.
I have previously revived the aero theme. It has a transparent background. Because I thought it would match the "aero" theme.
That exposed this bug. But I didn't do it intentionally.
Use the aero theme and put it in night mode. It is swallowed by the darkness, even though it has low transparency. That is clearly not the intended behavior.
This also applies to all objects and GUI parts as previously reported. The theme add-on created by Ranran and others causes the transparent pixels of the icon to turn black at night due to this problem.
For example, the outline of a button with a modern theme also has transparent pixels, which darkens the area at night and creates a strange appearance.
Therefore, we hope that the root of this problem will be fixed rather than making the background of the aero theme non-transparent. (´・ω・`)
Title: Re: Alpha channel drawing bug on the dialog window
Post by: prissi on May 03, 2021, 12:00:48 PM
That was hard work with all these templates etc Fixed in r9753
Title: Re: Alpha channel drawing bug on the dialog window
Post by: Ranran(retired) on May 04, 2021, 12:34:53 AM
Thank you for your excellent work. It has been fixed and is much better.
Also, it is nice that the edges of buildings and vehicles with transparent pixels output by 3D modeling placed on the GUI look beautiful even at night.  :)