Problem with masking

Hi guys,

I’ve been busy with a tutorial to help me with a small project i try to accomplish. I managed to place a video in perspective and i want to project it on a still image like you see below;


However, since i placed the video in perspective it shows gray borders around the actual footage. This tutorial: helped me to accomplish this:


Which i think is pretty close to where i need to be, unfortunately the tutorial does not show me how to import the footage with the masked area in to my video editor to move on with the project. Can anyone tell me how that is being done? (I already pushed the ‘animation’ button once to see what would happen, but that gave me 250 totally gray png’s)

Any help would be appreciated.

How are you generating the clip with perspective?

Using a keyer after that is a very robust solution to a problem that is introduced somewhere else. The result with warped image should have alpha channel to begin with, then you can simply AlphaOver it to your tv image.

The tutorial you linked is about greenscreen keying, screen replacement like you have here has very little to do with greenscreen. The purpose of greenscreen (literally green screen on tv, monitor or whatever) is to get a mask for objects moving in front of the screen being replaced. If there is nothing moving in front, simply warp the new picture, over it onto the screen and mask the edges (for curved bezel for example) manually.

ty very much, it would indeed be a lot simpler to make the tv screen transparant in the png and place it over the video like u said. However, i still would like to know how to move from here on, in my next project i might be using a moving mask (Or place this video over another video instead of a still image). And then i would be facing this problem again. I think i’m close to be learning something helpfull here :smiley:

Yes, but how are you doing the perspective warp in the firstplace? This is where it all begins, you must get the output of that operation in a way where the area outside the screen image is transparent.

For moving camera, the easiest way is to do a four corner pin (it is called cornerpin in most apps) to four corners of the tv. The corner points can either be animated by hand (tedious) or tracked with 2d trackers, planar tracker etc. Planar tracker is usually the best option because it does not need the four corners to be visible at all times (it tracks the whole surface with autoplaced features). Sometimes a full 3D track will be helpful, especially when the whole screen can be osbcured in some frames.

The mask part is what allows you to change the shape of placed image (output of cornerpin is rectangular, screen shape sometimes is not). This should also be tracked to the image exactly the same way as screen image itself. Sometimes it is easier to apply the mask to the image before the cornerpin operation, because this makes sure that the mask is locked to relative position on image and there is no sliding.

If there is something that obscures the screen during the clip, you need a mask for these foreground elements also. This is where the greenscreen part can be handy. If the screen is green/blue then you can key it and get a mask for foreground elements. With simply a black screen (or worse, some totally differently colored image) you must roto (animate the masks) the foreground elements manually and use these masks to place the FG on top of replaced screen. It can be tempting to cut a hole in the screen mask with FG element masks, but I find it more logical and easier to follow if the shot is composed back to front by overing each layer on top of another: original clip > screen replacement > FG elements

Maybe you get empty(?) png files while rendering is because you have not connected the output to the composite node.

Again ty for your answer, i’ll have to proces all the things u have pointed out to me. My knowledge doesn’t reach far outside the Video Sequencer (or even within for that matter). Perhaps i should watch some more (general) tutorials to clear some blank spots, maybe then i can get a grip on it.

When you say, “a gray border around …”, the first thing that comes to my mind is: “could it possibly have anything to do with pre-multiplied Alpha?” Anti-aliasing?

Also worth pondering: "is the effect both noticeable (to anyone other than yourself …), and, is it (to them …) objectionable? Because, IMHO, if the answer is “no,” you really don’t have a problem that you must deal with. Be careful not to let the project “stall” over this.

Here, the gray border is most probably from keying the gray background with Keying node.

When rushing a project one can pull off all kinds of corner-cuts, but in the long run it is way more useful solve these problems where they start, not build some additional obscure “solutions” on top. Because when they do become objectionable, you will get a lot of headache from things that would have been easy to solve in the beginning.

hi there,

its not like i’m trying to ‘rush the project’ or ‘cutting corners’. It’s the lack of knowledge what makes me do ‘strange things’. I wish there was a good a-z Blender tutorial. I saw the most of ‘Mikeycal Meyers’ tutorials regarding mostly the video sequencer. But besides the sequencer my knowledge is close to none.

Sorry i was a bit vague regarding the ‘gray borders’. I should have said; the area around the content after i placed it in perspective with the help of this tutorial:

Something like these may be more useful for what you’re doing.

Although, since you’re putting the footage over a still image, you could actually skip using the Plane track tools and simply use a corner pin node in the compositor to place your footage in the screen.

It looks from the screen shot that you don’t have the output hooked to ‘Composite’, only ‘Viewer’ - and this woudl mean that pressing Animation woudl get you blank frames. Try hooking to Composite node, and in Render settings in Properties window, choose ‘Alpha’ instead of sky and choose a file format that supports alpha channel, like png - and render to frames. You can then bring the frames into your video editor of choice (I use the VSE in blender) and use ‘alpha over’ to put them over the original footage.

thx, i will try to hook up the composite node as you told me to tomorrow and share what the output was. I also will get myself familiar the corner pin node. also thx for the link Hype.

Edit: I tried it right away (hook up the composite node) and it works! thx for filling up this blank spot for me.

I found a (bit old) tutorial that helped me to understand the cornerpin placement. It also showed me to auto-stabilize footage within blender. I hope most of the things in the tutorial still works in my version of Blender. This is the tutorial i’m talking about; together with