Hello 2021!

Match Tint  [SUBMITTED]

Moderator: SecondMan

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Match Tint

#1

Post by Shem Namo »

Hi everyone, hope you are doing great!!

I'm working on a keying tutorial, and needed to match the grade of the keyed foreground with the background.
I saw this interesting AE tutorial that uses AE's "Tint" effect to do exactly that.

So I made a DCTL fuse that maps the highlights of an input image to one color and the shadows to another color.
It's a pretty simple fuse, but it can be very useful.

I hope it can be useful to all of you.

Thanks again,
David


com.LearnNowFX.MatchTint.zip
You do not have the required permissions to view the files attached to this post.

User avatar
Millolab
Fusionista
Posts: 705
Joined: Wed Oct 24, 2018 6:26 am
Answers: 4
Contact:

Re: Match Tint

#2

Post by Millolab »

@Shem Namo A small suggestion: Why not adding a PreDivide/PostMultiply?

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#3

Post by Shem Namo »

Nice Suggestion @Millolab !!
I don't know what's the algorithm for that, do you happen to know it?

Thanks again.
David

Added in 19 minutes 24 seconds:
Never mind, I found it. :)

User avatar
Millolab
Fusionista
Posts: 705
Joined: Wed Oct 24, 2018 6:26 am
Answers: 4
Contact:

Re: Match Tint

#4

Post by Millolab »

well, I don't know any algorithm but the math is pretty simple: first you divide your RGB channels by the alpha, then do your tinting, then multiply RGB by the alpha again. That's all. How to implement that in a Fuse, well... I sadly don't know...

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#5

Post by Shem Namo »

Thanks @Millolab, I found the info in one of Vito's videos.
My only concern is: what if the alpha pixel is equal to 0?
Can't divide by zero. :P
I'll experiment for a little bit first.

Thanks again,
David

User avatar
Midgardsormr
Fusionator
Posts: 2015
Joined: Wed Nov 26, 2014 8:04 pm
Answers: 22
Location: Los Angeles, CA, USA
Been thanked: 3 times
Contact:

Re: Match Tint

#6

Post by Midgardsormr »

You'll need a test condition for alpha == 0, which will do nothing. It's pretty easy to verify your code against Fusion's own behavior. Check the Waveform subview on this:

Code: Select all

{
	Tools = ordered() {
		Background2 = Background {
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 3, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				TopLeftBlue = Input { Value = 0.431, },
				EffectMask = Input {
					SourceOp = "Background1",
					Source = "Output",
				}
			},
			ViewInfo = OperatorInfo { Pos = { 529, 121 } },
		},
		Background1 = Background {
			CtrlWZoom = false,
			Inputs = {
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 3, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				Type = Input { Value = FuID { "Gradient" }, },
				Start = Input { Value = { 0.482905982905983, 0.507604562737643 }, },
				Gradient = Input {
					Value = Gradient {
						Colors = {
							[0] = { 0, 0, 0, 0 },
							[1] = { 1, 1, 1, 1 }
						}
					},
				},
			},
			ViewInfo = OperatorInfo { Pos = { 406, 122 } },
		},
		Transform1 = Transform {
			Inputs = {
				ProcessAlpha = Input { Value = 0, },
				Center = Input { Value = { 0.282868525896414, 0.5 }, },
				Edges = Input { Value = 2, },
				Input = Input {
					SourceOp = "Background2",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 651, 123 } },
		},
		AlphaDivide1 = AlphaDivide {
			Inputs = {
				Input = Input {
					SourceOp = "Transform1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 766, 121 } },
		}
	}
}
That should give you an idea of the behavior to expect.

User avatar
SecondMan
Site Admin
Posts: 4781
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 30
Location: Vancouver, Canada
Been thanked: 18 times
Contact:

Re: Match Tint

#7

Post by SecondMan »

And version 1 i submitted! :cheer:

Please check if everything is working as you'd expect :)

Thanks!

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#8

Post by Shem Namo »

Thanks Pieter!!
I try it out asap.

Sorry that version 2 is coming so soon.
I should have asked you to postpone submission.
Sorry :oops:

Thanks again,
David

User avatar
SecondMan
Site Admin
Posts: 4781
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 30
Location: Vancouver, Canada
Been thanked: 18 times
Contact:

Re: Match Tint

#9

Post by SecondMan »

No worries :)

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#10

Post by Shem Namo »

And here it is:
v1.1, now with a Pre-Divide/Post-Multiply control.

@SecondMan, if you have time could you please update it?

Thanks again,
David
com.LearnNowFX.MatchTint.zip
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 4781
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 30
Location: Vancouver, Canada
Been thanked: 18 times
Contact:

Re: Match Tint

#11

Post by SecondMan »

Available in Reactor now, thanks! :cheer:

(I adjusted the date in the atom file for you)

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#12

Post by Shem Namo »

Hi @SecondMan, It's a little late, but I want to thank you for fixing the date in the Atom.

A friend of mine was trying to install this fuse from Reactor, but it didn't show up.
I think that the problem was in the atom and also in the fuse, so I think I fixed the problem.

If you have some time, could you please update the atom?

Thanks again,
David
com.LearnNowFX.MatchTint.zip
You do not have the required permissions to view the files attached to this post.

User avatar
SecondMan
Site Admin
Posts: 4781
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 30
Location: Vancouver, Canada
Been thanked: 18 times
Contact:

Re: Match Tint

#13

Post by SecondMan »

No problem, you're welcome :)

The problem seemed to be that previously you had put the Fuse in a Tools folder, rather than a Fuses folder.

The Fuse is in the correct folder now, but you've also changed the Atom Category to Fuses/Color, rather than Tools/Color which doesn't follow convention and is not conform your other tools.

Make the quick change on your end? Just so we're in sync here...

User avatar
Shem Namo
Fusionista
Posts: 649
Joined: Sun Oct 06, 2019 9:15 pm
Answers: 1
Location: North Israel
Real name: David Kohen
Been thanked: 1 time

Re: Match Tint

#14

Post by Shem Namo »

Do you mean that I can have the category in the Tools/Color menu, while the fuse is in the Fuses/Color folder?

Thanks again,
David

User avatar
SecondMan
Site Admin
Posts: 4781
Joined: Thu Jul 31, 2014 5:31 pm
Answers: 30
Location: Vancouver, Canada
Been thanked: 18 times
Contact:

Re: Match Tint

#15

Post by SecondMan »

Err, yes, just like you have done it with all your other tools :P