[Cin] Some tests on blending
Georgy Salnikov
sge at nmr.nioch.nsc.ru
Tue Apr 1 08:54:44 CEST 2025
On Mon, 31 Mar 2025, Andrea paz wrote:
> I re-tested and most of the color-related plugins do not have
> clipping. Unfortunately (at least for me) some of the most important
> plugins have it:
Perhaps you can easily get around these restrictions with the following hack.
Create a blend program like this (an example, adapt it to your needs):
BLEND_PROGRAM_INIT
COLORSPACE_RGB
PARALLEL_SAFE
BLEND_PROGRAM_PROC
float mult;
mult = KEY_A-0.5;
if (mult >= 0) mult = 1+mult*10;
else mult = 1/(1-mult*10);
R(0) = R(0)*mult;
G(0) = G(0)*mult;
B(0) = B(0)*mult;
BLEND_PROGRAM_END
First attach this blend program to your track above the other plugin which
you want to make not to clip. Switch clipping off in the blend program
dialog. This blend program will use the alpha slider (which can have the
value between 0.0 and 1.0) in the following manner:
0.5 (exactly in the middle): no RGB change
0.6: R,G,B are multiplied by 2
0.7: multiplied by 3
...
1.0: multiplied by 6
0.4: multiplied by 1/2 (i.e. divided by 2)
0.3: multiplied by 1/3
...
0.0: multiplied by 1/6 (divided by 6)
If you set it, for example, to 0.4 here, your R,G,B values will be divided
by 2, so that the color values up to 2.0 will be scaled down into the clip
range. If you can have values up to, let's say, 5.0, then set the alpha
slider to 0.1 to scale down by 5, etc.
Then attach the plugin you need to work unclipped, your histogram or
whatever. Pay attention that all the color values your plugin gets now, are
scaled down uniformly.
Then attach the same blend program once more, under your needed plugin. This
time set the alpha slider to 0.6 (if it is 0.4 in the upper une), or to 0.9
(if the upper one is 0.1), i.e. displace it from the middle in the opposite
direction. The unclipped values coming from your working plugin will be
scaled back by the same amount.
Relax and have fun, Andrea:)
_______________________________________________________________________________
Georgy Salnikov
NMR Group
Novosibirsk Institute of Organic Chemistry
Lavrentjeva, 9, 630090 Novosibirsk, Russia
Phone +7-383-3307864
Email sge at nmr.nioch.nsc.ru
_______________________________________________________________________________
More information about the Cin
mailing list