The International Simutrans Forum

 

Author Topic: Alpha channel drawing bug on the dialog window  (Read 631 times)

0 Members and 1 Guest are viewing this topic.

Offline Ranran jp

  • *
  • Posts: 471
  • Languages: ja
Alpha channel drawing bug on the dialog window
« 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.






It is the same in every dialog window, such as line managemant screen and convoi list, not only in depot.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1253
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Alpha channel drawing bug on the dialog window
« Reply #1 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.


Offline Ranran jp

  • *
  • Posts: 471
  • Languages: ja
Re: Alpha channel drawing bug on the dialog window
« Reply #2 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.

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.
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.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1253
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Alpha channel drawing bug on the dialog window
« Reply #3 on: January 12, 2019, 04:27:36 PM »

Does 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.
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.
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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4587
  • Languages: EN, DE, AT
Re: Alpha channel drawing bug on the dialog window
« Reply #4 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.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9513
  • Languages: De,EN,JP
Re: Alpha channel drawing bug on the dialog window
« Reply #5 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?