Welcome to WSL!

Make yourself at home, but before posting, please may I ask you to read the following topics.


Posting 101
Server space, screenshots, and you

Thank you!

PS. please pretty please:


Image

Extend image edges

Moderator: SecondMan

User avatar
JimbobVFX
Posts: 21
Joined: Tue Jun 23, 2020 9:16 am

Extend image edges

#1

Post by JimbobVFX » Fri Jun 26, 2020 5:20 pm

How can I get the effect of merging my image over a larger transparent image, effectively adding a transparent border to my image?

If I use a background node it an only be solid.

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

Re: Extend image edges

#2

Post by Midgardsormr » Fri Jun 26, 2020 5:24 pm

Turn the Alpha on the Background to 0.

User avatar
JimbobVFX
Posts: 21
Joined: Tue Jun 23, 2020 9:16 am

Re: Extend image edges

#3

Post by JimbobVFX » Fri Jun 26, 2020 5:36 pm

Hmm. I just noticed I can change the Alpha in the background node. Strangely, if I don't choose black as the color, the viewer still show color at about 50% transparency, even though if you look at the alpha channel it shows full transparency.

So it seems impossible to have say a red background at 5% transparency. Bug?

User avatar
Kristof
Fusionista
Posts: 778
Joined: Thu Aug 07, 2014 1:30 pm
Answers: 2
Been thanked: 23 times

Re: Extend image edges

#4

Post by Kristof » Sat Jun 27, 2020 2:17 am

No, that's not a bug. Compositing 101: pre/post multiplication. Either you do the math for RGB or you pick your value as if it were fully opaque, set A to whatever you need and then add an "AlphaMultiply" right after your Background node to let Fu do it for you. In your case:

Code: Select all

{
	Tools = ordered() {
		Plasma1_1 = Plasma {
			Inputs = {
				GlobalIn = Input { Value = 1001, },
				GlobalOut = Input { Value = 2001, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 4, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
			},
			ViewInfo = OperatorInfo { Pos = { 110, 214.5 } },
		},
		Ellipse1 = EllipseMask {
			Inputs = {
				Level = Input { Value = 0.95, },
				MaskWidth = Input { Value = 1920, },
				MaskHeight = Input { Value = 1080, },
				PixelAspect = Input { Value = { 1, 1 }, },
				ClippingMode = Input { Value = FuID { "None" }, },
			},
			ViewInfo = OperatorInfo { Pos = { 220, 181.5 } },
		},
		Background1 = Background {
			Inputs = {
				GlobalIn = Input { Value = 1001, },
				GlobalOut = Input { Value = 2001, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 4, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				TopLeftRed = Input { Value = 1, },
				TopLeftAlpha = Input { Value = 0.95, },
			},
			ViewInfo = OperatorInfo { Pos = { 220, 313.5 } },
		},
		Merge1_1 = Merge {
			CtrlWZoom = false,
			Inputs = {
				Background = Input {
					SourceOp = "Plasma1_1",
					Source = "Output",
				},
				Foreground = Input {
					SourceOp = "Background1_1",
					Source = "Output",
				},
				PerformDepthMerge = Input { Value = 0, },
			},
			ViewInfo = OperatorInfo { Pos = { 330, 214.5 } },
		},
		Background1_1 = Background {
			Inputs = {
				GlobalIn = Input { Value = 1001, },
				GlobalOut = Input { Value = 2001, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 4, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
				TopLeftRed = Input { Value = 1, },
				EffectMask = Input {
					SourceOp = "Ellipse1",
					Source = "Mask",
				}
			},
			ViewInfo = OperatorInfo { Pos = { 330, 181.5 } },
		},
		Plasma1 = Plasma {
			Inputs = {
				GlobalIn = Input { Value = 1001, },
				GlobalOut = Input { Value = 2001, },
				Width = Input { Value = 1920, },
				Height = Input { Value = 1080, },
				Depth = Input { Value = 4, },
				["Gamut.SLogVersion"] = Input { Value = FuID { "SLog2" }, },
			},
			ViewInfo = OperatorInfo { Pos = { 110, 346.5 } },
		},
		AlphaMultiply1 = AlphaMultiply {
			Inputs = {
				Input = Input {
					SourceOp = "Background1",
					Source = "Output",
				},
			},
			ViewInfo = OperatorInfo { Pos = { 330, 313.5 } },
		},
		Merge1 = Merge {
			Inputs = {
				Background = Input {
					SourceOp = "Plasma1",
					Source = "Output",
				},
				Foreground = Input {
					SourceOp = "AlphaMultiply1",
					Source = "Output",
				},
				PerformDepthMerge = Input { Value = 0, },
			},
			ViewInfo = OperatorInfo { Pos = { 330, 346.5 } },
		}
	}
}
But you need to be aware of what's going on. It's not hard but check the 1st example in the code shared. If you add a post multiplication right after the BG with the circular shape (the 5% transparency is coming from that shape; see "level") you'll be multiplying it twice and that's not what you want.

User avatar
TheBloke
Posts: 26
Joined: Wed Jun 17, 2020 6:02 am

Re: Extend image edges

#5

Post by TheBloke » Sat Jun 27, 2020 3:27 am

For anyone else like me who is new to compositing and Fusion, I can highly recommend Simon Ubsdell's tutorials. In particular, he has a series of 7 tutorials called Compositing School, which use Fusion to demonstrate the basics of blend modes, alpha channels, pre-multiplication, image brightness, and more.

He uses the Custom Tool in every tutorial to show the exact maths involved in every operation. It's fascinating stuff to a newbie like myself, and I mention it here because it covers in detail Bryan's point about premultiplication, and shows how one can deal with it (and variations, such as premultiplication with white or another colour) using the Custom Tool.

Simon Ubsdell's Compositing School YouTube playlist