<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">вс, 13 апр. 2025 г., 16:05 Georgy Salnikov <<a href="mailto:sge@nmr.nioch.nsc.ru" target="_blank" rel="noreferrer">sge@nmr.nioch.nsc.ru</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, 11 Apr 2025, Andrew Randrianasulu wrote:<br>
<br>
> > I think we hit crudest form of this limitation when we try to fade<br>
> > titler's text over png image. It sort of flashes, due to missing<br>
> > (unapplied) 2.4 gamma step?<br>
<br>
No, the reason for "flashes" for fading in titles and dissolve transitions<br>
in transparent PNGs is totally other.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Hm, so we invented wrong solution then, because I recall for some reason doing inter-track mixing as sRGB with provided equation visually fixed that flash ....</div><div dir="auto"><br></div><div dir="auto"><pre>+//#define LINEAR2SRGB(in) (in <= 0.0031308 ? 12.92 * in : 1.055 * mpow(in, 1.0/GAMMA) - 0.055)
+//#define SRGB2LINEAR(in) (in <= 0.04045 ? in / 12.92 : mpow((in + 0.055) / 1.055, GAMMA))
+
+#define A_BLEND(top, bottom, alpha, max) \
+ max * linear_to_srgb(srgb_to_linear(1. * top / max)+ srgb_to_linear(1. * bottom / max)*(1.0 - (1. * alpha / max)))
+
+// Change lines:
+// #define ALPHA_NORMAL(mx, Sa, Da) (Sa + (Da * (mx - Sa)) / mx)
+// #define COLOR_NORMAL(mx, Sc, Sa, Dc, Da) ((Sc * Sa + Dc * (mx - Sa)) / mx)
+// To:
+#define ALPHA_NORMALS(mx, Sa, Da) ((Sa + (mx - Sa)*(mx - Sa)) / mx)
+#define COLOR_NORMALS(mx, Sc, Sa, Dc, Da) A_BLEND(Sc, Dc, Sa, mx)
+#define CHROMA_NORMALS COLOR_NORMALS</pre></div><div dir="auto">This makes me wonder about time when researchers just played around with equations to see if any of them make interesting visual results .....</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Take and unpack the small archive in attachment.<br>
<br>
unwanted_black_flash.xml is a small demo project, IgorBeg has created it a<br>
few years ago to demonstrate the quirks. There are a white title over violet<br>
background with 5 sec fade in, and two white PNGs with transparent<br>
background with 5 sec Dissolve transition in between. Try to play it,<br>
focusing on the fading and the transition, it is not so easy to figure out,<br>
what is not correct.<br>
<br>
And yes, what we have now, is Blend Program. You can load now ubf1.xml, it<br>
uses two simple programs which print the values of R, G, B, A (the project's<br>
color model is RGBA-8bit) inside some letter in the title, and inside each<br>
of the two PNGs.<br>
<br>
What do we see? For the title:<br>
Title RGBA: 0.00 / 0.00 / 0.00 / 0.00<br>
Title RGBA: 0.00 / 0.00 / 0.00 / 0.00<br>
Title RGBA: 0.01 / 0.01 / 0.01 / 0.01<br>
Title RGBA: 0.02 / 0.02 / 0.02 / 0.02<br>
Title RGBA: 0.02 / 0.02 / 0.02 / 0.02<br>
Title RGBA: 0.03 / 0.03 / 0.03 / 0.03<br>
.....................................<br>
Title RGBA: 0.97 / 0.97 / 0.97 / 0.97<br>
Title RGBA: 0.98 / 0.98 / 0.98 / 0.98<br>
Title RGBA: 0.98 / 0.98 / 0.98 / 0.98<br>
Title RGBA: 0.99 / 0.99 / 0.99 / 0.99<br>
Title RGBA: 1.00 / 1.00 / 1.00 / 1.00<br>
<br>
Pay attention on these numbers! What do you see? A smooth increase of white<br>
title opacity over the background? No, you see here a smooth transition from<br>
the transparent black letters (RBG=0.00/0.00/0.00 is black, not white) to<br>
the opaque white, with some semi-transparent grey in the middle.<br>
<br>
The Dissolve transition does the similar:<br>
1 RGBA: 1.00 / 1.00 / 1.00 / 1.00<br>
2 RGBA: 0.00 / 0.00 / 0.00 / 0.00<br>
1 RGBA: 1.00 / 1.00 / 1.00 / 1.00<br>
2 RGBA: 0.00 / 0.00 / 0.00 / 0.00<br>
1 RGBA: 0.99 / 0.99 / 0.99 / 0.99<br>
2 RGBA: 0.01 / 0.01 / 0.01 / 0.01<br>
.................................<br>
1 RGBA: 0.01 / 0.01 / 0.01 / 0.01<br>
2 RGBA: 0.99 / 0.99 / 0.99 / 0.99<br>
1 RGBA: 0.00 / 0.00 / 0.00 / 0.00<br>
2 RGBA: 1.00 / 1.00 / 1.00 / 1.00<br>
<br>
The first PNG gradually changes from opaque white to transparent black, the<br>
second one does the same in the backward direction, both being<br>
semi-transparent grey in the middle.<br>
<br>
Although one can imagine a case where exactly such behaviour (fading from<br>
white to black) could be desired, here it is definitely not that what is<br>
wanted, as the background track has some other color.<br>
<br>
Load the third example, ubf2.xml. It tries to demonstrate how this all<br>
should look, were it all consistent. I removed the title fading from the<br>
titler plugin and configured fading in the Fade Autos for the track. Now the<br>
letters gradually come from transparent white to opaque white, not from<br>
black to white. The transition is not so easy to imitate, so I added one<br>
more track and put the second PNG there with 5 sec overlap with the first<br>
one, and made the same transition from white to transparent white via the<br>
Fade Autos. This all looks quite different now!<br>
<br>
It is obvious: fading in titler and in Dissolve is to be done solely on the<br>
Alpha channel, not touching colors, provided that the track where it takes<br>
place has no transparent areas. Alternatively, it can be done in the RGB<br>
channels, without touching Alpha channel, actually it is what takes place if<br>
the project is pure RGB, without transparency. But what must Dissolve do, if<br>
there is also a controlled transparency in the track, perhaps different in<br>
the two parts between which Dissolve is played, seems not to be obvious...<br>
_______________________________________________________________________________<br>
<br>
Georgy Salnikov<br>
NMR Group<br>
Novosibirsk Institute of Organic Chemistry<br>
Lavrentjeva, 9, 630090 Novosibirsk, Russia<br>
Phone +7-383-3307864<br>
Email <a href="mailto:sge@nmr.nioch.nsc.ru" rel="noreferrer noreferrer" target="_blank">sge@nmr.nioch.nsc.ru</a><br>
_______________________________________________________________________________<br>
</blockquote></div></div></div>