Masking 3d object on shaky scene

Hello there
I have mocha solved motion scene shot (a simple city street).
I have a 3d object composited on the street. When a part of the object should be covered by building I need to create a mask. Until here I understand. I make a mask and it works but! The mask is under the 3d object and moves with the object. I want the mask to follow the camera motion to maintain the scene shake.
Please advise. How do I assign the camera motion path to 3d object mask?
Thank you


  • AxelWilkinson
    AxelWilkinson Posts: 5,255 Staff
    Make a duplicate copy of the footage, and mask out everything but the building on the duplicate.  Then move the building above your 3D model, and you're good to go.
  • Moop
    Moop Posts: 3
    Thank you I will do this. Good thinking. I guess I have to shuffle my layers as I have a lot adjustments on the footage.
    Thanks again!!
  • Moop
    Moop Posts: 3
    OK so it would work, BUT:
    The source video is moving a lot and also the viewing perspective is changing. This mean I would have to rotoscope the mask. Or I would need to track the Building I want to cover and then attach the new mask to this track.
    I was hoping that there would be an easier option.
  • SimonKJones
    SimonKJones Posts: 4,370 Enthusiast
    Rotoscoping may be required, depending on the nature of the shot, especially if the mask shape needs to change over time.
    If you want to try tracking the mask to the shot, I'd suggest creating the matte on a separate layer, parenting it to a tracking point, then using Set Matte to actually apply the matte to the 3D object.
    For example, here's a shot from the HF2 trailer:
    I created a matte for the railings in GIMP as a still image, imported that image, tracked it onto the footage, and then used Set Matte to apply the matte to the helicopter. This meant I only had to draw a single matte on one frame for the railings, even though it was a handheld camera:
    Of course, this generally will only work for shots containing relatively simple camera movement - in this case it was just a pan/tilt shot. If you have 3D movement things get trickier.
    Incidentally, I still had to manually roto the movement of the actress. But the matte trick saved a huge amount of time when masking the railings.
  • VictorVideo
    VictorVideo Posts: 4 Enthusiast
    I have a similar setup
    In the helicopter example, Set Matte makes the railings appear in front of the helicopter
    I followed your example but can't get the white matte to become transparent revealing the railings (another object in my case)
  • AxelWilkinson
    AxelWilkinson Posts: 5,255 Staff
    For that, you just turn off the visibility of the matte layer.