вс, 13 апр. 2025 г., 16:05 Georgy Salnikov <[email protected]>:
> On Fri, 11 Apr 2025, Andrew Randrianasulu wrote: > > > > I think we hit crudest form of this limitation when we try to fade > > > titler's text over png image. It sort of flashes, due to missing > > > (unapplied) 2.4 gamma step? > > No, the reason for "flashes" for fading in titles and dissolve transitions > in transparent PNGs is totally other. > 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 .... +//#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 This makes me wonder about time when researchers just played around with equations to see if any of them make interesting visual results ..... > Take and unpack the small archive in attachment. > > unwanted_black_flash.xml is a small demo project, IgorBeg has created it a > few years ago to demonstrate the quirks. There are a white title over > violet > background with 5 sec fade in, and two white PNGs with transparent > background with 5 sec Dissolve transition in between. Try to play it, > focusing on the fading and the transition, it is not so easy to figure out, > what is not correct. > > And yes, what we have now, is Blend Program. You can load now ubf1.xml, it > uses two simple programs which print the values of R, G, B, A (the > project's > color model is RGBA-8bit) inside some letter in the title, and inside each > of the two PNGs. > > What do we see? For the title: > Title RGBA: 0.00 / 0.00 / 0.00 / 0.00 > Title RGBA: 0.00 / 0.00 / 0.00 / 0.00 > Title RGBA: 0.01 / 0.01 / 0.01 / 0.01 > Title RGBA: 0.02 / 0.02 / 0.02 / 0.02 > Title RGBA: 0.02 / 0.02 / 0.02 / 0.02 > Title RGBA: 0.03 / 0.03 / 0.03 / 0.03 > ..................................... > Title RGBA: 0.97 / 0.97 / 0.97 / 0.97 > Title RGBA: 0.98 / 0.98 / 0.98 / 0.98 > Title RGBA: 0.98 / 0.98 / 0.98 / 0.98 > Title RGBA: 0.99 / 0.99 / 0.99 / 0.99 > Title RGBA: 1.00 / 1.00 / 1.00 / 1.00 > > Pay attention on these numbers! What do you see? A smooth increase of white > title opacity over the background? No, you see here a smooth transition > from > the transparent black letters (RBG=0.00/0.00/0.00 is black, not white) to > the opaque white, with some semi-transparent grey in the middle. > > The Dissolve transition does the similar: > 1 RGBA: 1.00 / 1.00 / 1.00 / 1.00 > 2 RGBA: 0.00 / 0.00 / 0.00 / 0.00 > 1 RGBA: 1.00 / 1.00 / 1.00 / 1.00 > 2 RGBA: 0.00 / 0.00 / 0.00 / 0.00 > 1 RGBA: 0.99 / 0.99 / 0.99 / 0.99 > 2 RGBA: 0.01 / 0.01 / 0.01 / 0.01 > ................................. > 1 RGBA: 0.01 / 0.01 / 0.01 / 0.01 > 2 RGBA: 0.99 / 0.99 / 0.99 / 0.99 > 1 RGBA: 0.00 / 0.00 / 0.00 / 0.00 > 2 RGBA: 1.00 / 1.00 / 1.00 / 1.00 > > The first PNG gradually changes from opaque white to transparent black, the > second one does the same in the backward direction, both being > semi-transparent grey in the middle. > > Although one can imagine a case where exactly such behaviour (fading from > white to black) could be desired, here it is definitely not that what is > wanted, as the background track has some other color. > > Load the third example, ubf2.xml. It tries to demonstrate how this all > should look, were it all consistent. I removed the title fading from the > titler plugin and configured fading in the Fade Autos for the track. Now > the > letters gradually come from transparent white to opaque white, not from > black to white. The transition is not so easy to imitate, so I added one > more track and put the second PNG there with 5 sec overlap with the first > one, and made the same transition from white to transparent white via the > Fade Autos. This all looks quite different now! > > It is obvious: fading in titler and in Dissolve is to be done solely on the > Alpha channel, not touching colors, provided that the track where it takes > place has no transparent areas. Alternatively, it can be done in the RGB > channels, without touching Alpha channel, actually it is what takes place > if > the project is pure RGB, without transparency. But what must Dissolve do, > if > there is also a controlled transparency in the track, perhaps different in > the two parts between which Dissolve is played, seems not to be obvious... > > _______________________________________________________________________________ > > Georgy Salnikov > NMR Group > Novosibirsk Institute of Organic Chemistry > Lavrentjeva, 9, 630090 Novosibirsk, Russia > Phone +7-383-3307864 > Email [email protected] > > _______________________________________________________________________________ >
-- Cin mailing list [email protected] https://lists.cinelerra-gg.org/mailman/listinfo/cin

