Copy link to clipboard
Copied
To simplify, I have a gray logo (50% opacity). I want the logo to be always visible as the topmost layer. The problem is, sometimes the background is black, sometimes gray, sometimes white. I want the logo to always be visible. Probably the best solution is to make the logo always lighter than the background except if bg is very light, make it dark instead. None of the basic blending options achieve this.
What's the simplest way to accomplish this automatically?
Copy link to clipboard
Copied
Not really. 50% opacity and then using a medium gray essentially renders each and every trick in the book useless because blending modes don't do much around their midpoint. You are literally shooting yourself in the foot here. If at all, you might use a sampleImage() expression covering the size of your logo and tie it to a shape layer color fill or an effect like fill or Tint to dynamically adjust the color, but even that can look wrong depending on teh actual colors beneath. Something like this perhaps:
mBack=thisComp.layer("Background");
mLogo=thisComp.layer("Logo");
mColBackRGB=mBack.sampleImage(mLogo.transform.position, [mLogo.width, mLogo.height]);mColBackHSL=rgbToHsl(mColSourceRGB);
mColBackLumaInvert=linear(mColSourceHSL,0,1,1,0);
mColLogoRGB=mLogo.effect("Logo Color")("Color");
mColLogoHSL=rgbToHsl(mColLogoRGB);
mColLogoLuma=mColLogoHSL[2]*mColBackLumaInvert;
mColLogoOut=hslToRGB([mColLogoHSL[0],mColLogoHSL[1],mColLogoLuma]
This will invert the luminace of the logo color based on the accumulated background average luminance in the spot where the logo is. may work, may not. Paste the code into whatever effect you use to modify the color. Just don't forget to adapt the names and create the custom color expression control for the logo's default color.
Mylenium
Copy link to clipboard
Copied
Thank you very much. However, I didn't understand the mColSourceRGB and mColSourceHSL parts. They are not defined, what should they be? (Also one parenthesis was missing at the end.)