# I solved camera with MOCHA, now what?

edited July 30

here's my quick question

P.S> needless to say I exported track data and reimported it as a Comp shot and than I dragged my Video Footage comp inside.

• Moderator
edited July 31

OK, so, you did the most important thing right - you tracked the castle. A key thing in tracking for insertions is to track as close as you can to where you want to insert the 3D element.

Now, with Mocha and Foundry there's usually a little bit of fiddling around with the imported elements to get them to sit correctly. Let's look at you castle spline - you're tracking the forward wall of the castle so your position points reflect that wall, not the center of mass. Lets say for sake of argument we want to parent the model to the bottom-right track point of the castle. I'd probably shift the anchor point of the model around so the anchor point is at the part of the model that fits closest to that part of the wall. That way, when I'm doing rotation and scale adjustments of the model to fine tune it, it's going to rotate and scale around that "desired point" instead of center of mass.

Let me ask a couple of questions/make a few observations about your mocha track. The video is showing the splines, but not the 3D surface or alignment grid. (The surface is a blue rectangular shape, the alignment grid is pink.)The points mocha generates represent the four corners of the surface and the center of the surface. The surface has nothing at all to do with the tracking splines. The surface will always be a perfect rectangle. You'll adjust the corners of the surface and Mocha will  attempt to read the corner offest and use that to calculate perspective to try and get the 3D orientation of the surface. Because Mocha is tracking what it thinks are flat rectangles, doing a camera solve by measuring the movement of those rectangles relative to each other, it's possible for Mocha to return a "99%" accurate solve that's actually totally off. Mocha needs you to use the surface tool/alignment grid before doing the camera solve. Since your video isn't showing the surface/alignment, I have to assume you missed that step, just for safety.

Now, to contradict myself, sometimes you don't want to bother adjusting the surface... Mocha is some serious voodoo and getting good solves is a bit more of an art than a hard science. For your shot, those far background mountains can have the surface flat-on to the camera. Those are so far away there's no parallaxing visible. That foreground hill is a little tricky because there's grass and trees and it's a hill, so there's probably rises and dips. You'll want to use the surface/alignment grid on that area, but you'll also have to understand (and settle for) an approximate angle, simply because it's not truly a flat surface. The CASTLE is the important one. You'll certainly want to align the surface as accurately as possible to the same wall you tracked. The castle is what you want to replace, and the bottom edge of the surface is going to be at "ground level."

So, since I can't see your surfaces, just double check those, ok? Then re-solve your camera.

Incidentally, when you export the comp shot from mocha it only adds to point layers for layers that are active and highlighted in mocha. Since you're not putting anything on the background mountains you don't need that layer. Unless you're adding something to the foreground hill you don't need that layer either.Turning off those layers in mocha before export removes ten points of data you don't need. Keeps your layer stack in Hitfilm cleaner.

Yeah, so, surfaces checked, camera solved and exported. Load in your model and certainly move the anchor point to ground level of the model. Consider moving the anchor point to ground level at what will be the front wall. This depends on if your inserted castle is going to be the same(ish) size as the original, or a lot bigger. Definitely get the anchor point on at ground level, though, As mentioned earlier this will make refining placement easier.

Ok, so parent your model to a point on the castle. I'd still use castle bottom right. Then go into the model's transform properties and 0 out position and rotation/orientation. Your castle will appear on the point and will probably be the wrong size and pointing in a strange direction... But since you've moved your model's anchor point to it's ground level and the point you've parented to should be at ground level you'll just be able to use the widget to rotate your model into place and re-scale.

I'm gonna toss in a couple of tutorials here. Mocha's interface changed a couple of years ago and I'm not 100% the Film Empire tutorial is using the most recent interface, but Jaime talks about the surface/alignment grid. The most recent FXHOME tutorial I found is about corner pinning, which isn't the same....

There's a concept that Hashi - the Action Movie Dad - calls "Normalizing  Your Scene." See, since Mocha is generating 3D space by tracking some arbitrary rectangles and how they move around each other, and foundry is tracking point moving around each other it's important to remember that neither Mocha or Foundry know anything about the real 3D space. They don't know how big that castle is, how far away it is, how far away the drone is, how fast the drone is moving... It's making a guess based on parallax... This "guess" is why I say "it's voodoo." and this guess is why almost every track comes in at a strange scale or strange world angle. There are infinite mathematical solutions to each track and the software has to just pick one... So, Normalizing the Scene is finding a tracked point, using a temp rig to move that tracked point to the center of the Hitfilm/Ae 3D space then using that temp rig to scale everything so that a 3D plane placed at the reference point more or less fills the screen. Basically taking something that might have come in at a strange angle with the camera moving 500,000 units in three seconds and correcting that. Hashi's tutorial is for Ae, but I'm linking it in because he explains it better. But, below that I'm linking an old Mocha Hitfilm tutorial from the Hitfilm Ultimate 2 days, which is about aligning your scene to center it in Hitfilm's 3D space. That's half of what Hashi is doing, but I think if you watch Hashi's tutorial and the Mocha tutorial you'll figure out how to normalize your scene in Hitfilm. That makes it a LOT easier to place things.

The steps would be different, but the same concept applies to Foundry tracks.

I think/hope that gets you going.

• If I might, let me also throw in this outstanding video by Hashi for Red Giant in AE...

https://youtu.be/KfaGuHeYStA

In it, he talks about normalizing the track at 6:20 minutes. There is a table of contents in the description to see all the rest of the things that he does. It is a great video! Here is part 2 (which doesn't talk about normalizing the track, but is still really good)...

https://youtu.be/x4XjNWUXUd8

• @Triem23 Wow man that was very comprehensive and eye opening. I hope it gets pinned on a general tracking topic in best off.  First of all I want to thank you for putting time to write all of this. I do use After Effects mostly for tracking as I find their native tracker incredibly easy and intuitive. I found that Normalization video before and I downloaded Normalize plugin for AE and also another one that converts AE tracks into .ma files for HitFilm import. My question this time was more concerning Mocha though as I keep leaving HitFilm, to track in AE and most of the time I could have probably gotten away with tracking in Hitfilm if I understood principles of how it actually works. But as you said there's a lot of "voodoo" involved:)

I am just feel more comfortable with HitFilm so this might sound crazy as I am not sure if this is a normal way of compositing but what I did was I tracked it in AE, than I exported layers as RGB+ALPHA out of AE and literally stacked them into layers in HitFilm. So all the 3D renders from Element3D in After Effects are now on their own video layers in HitFilm rotating in the same perspective due to a perfect AE track. So that was just a band aid until I read what you guys wrote here.

Thank you @FilmSensei I actually have watched that tutorial too.  I have to keep rewatching  them because I lose small details here and there and then I don't understand the big picture. There is so much to learn.

So when I track front wall of the castle and if I parent my 3D model to that front wall, shouldn't they both have a sam position of the anchor point, which is the middle of the mass? I understand that mocha is a planar tracker and there is no center because it tracks flat surfaces changing perspective but since I can Quad Wrap my 3D castle on 4 Mocha points of the tracked front wall, how do I adjust it to where it shifts in parallax and perspective with the rotation of the drone since it is suppose to rotate like that tracked plane? I hope my question makes sense. Thank you

• Moderator

So on the Anchor point and which track point I'd use...

To repeat I'd line up the Mocha surface to the front wall and make sure the bottom of my surface met ground level. Then I'd use one of the bottom (ground) points The castle needs to sit on the ground and starting with a point at ground level means I don't have to adjust for a "floating" track.

For the castle you definitely want to move the anchor point to ground level... That way if you have to rescale it just "grows/shrinks" from ground level. Spaceships and planes you can usually leave the anchor point in the center of mass, but, for a car, character, building - anything that sits on the ground - it's better to move that anchor point to ground level so scale/rotation doesn't shift the model off the ground plane. Sensei discusses this in a couple of videos. I think Javert, Axel and Simon all covered that in varied FXHOME tuts as well.

Moving the anchor point to the front wall of the castle model is optional, but, if you want the front wall of the model aligned with the front wall of the original footage, again, shifting the anchor point will just lock that wall in place, so, as you rotate and scale you don't have to keep moving the model back into position.

Basically the single step of moving that anchor point can eliminate a buch of little steps later.

• @Triem23 I totally  understand what you mean. Also I did use pink grid and blue rectangle and I think I did it BEFORE I pressed Solve Camera. They seemed ok aligned. Also the only reason I tracked mountains and foreground is because I don't think mocha can solve camera with only 1 shape. Or maybe I am wrong. As I said I trying to learn how to use Mocha and Foundry.

• Moderator
edited August 1

Ok, if you checked your track with Surface and Alignment grid you're good.

Mocha requires at least two shapes for a camera solve if the camera is moving. If the camera is on a tripod and only panning/tilting then you only need one shape. I usually like to track three or four shapes for a camera solve.

I'm about to make dinner*, but, hopefully I remember later to track down some of my favorite mocha tutorials. Most of them are older - several versions ago - but they date back to when everyone did longer, more comprehensive tutorials. For better or worse, Youtube rewards short-duration content and many channels tutorials are getting shorter.

No insult to those channels. Especially if it's Imagineer/Mocha or FXHOME. You exploit the algorithm to grow your channel, right? But, if you were to dive deep into the FXHOME channel you'll see a lot of 15-20 minute tutorials back in the Hitfilm 2-4 days and a lot of under 10-minute tutorials today. Which mocha tutorial is most in depth - the five minute tutorial, or the 15 minute tutorial, or the three-part 45 minute tutorial?

Anyways, there are some really good tutorials and webinars Imagineer put out a few years ago that have some really good hints. Their more recent stuff suffers from the "We're making it shorter, plus we've already done 20 tutorials on this and I'm not into repeating myself" school. ;-)

*Fried rice. The chicken is marinating, I've got the shrimp bagged and defrosting in some water. Veggies got sliced and diced days ago, and muh wifey roasted up fresh garlic then churned up some cream and made a hommade garlic butter.... This is gonna be good.

I managed to make it work but also I instantly had audacity to make a little joke tutorial for my buddies so don't judge me , nor the poor sound quality. I literally ended up replacing 80 percent of the elements hahaha.

Yes throw any Mocha tutorials please I need to get a grip on this. And bon apetit

• Moderator

Your video is showing as blocked in the US. YouTube's content bots snapped that up immediately.

Now, we're in the same time zone, but I've worked night shifts in bars for over a decade and my body remains on graveyard hours - it's just about my bedtime. I'll grab imagineer tutorials for you later tonight.

Here are some of good tutorials FXHOME produced back in the day. The main thing to watch for is earlier versions of mocha included the footage in the imported comp shot. This created a duplicate of the footage in the media bin which added up. Of course now we just get the camera/point data and the blue plane (which, btw is the current "active" layer in Mocha.

https://youtu.be/TPmzwa5rA_o

https://youtu.be/I8prB4yKhS8

https://youtu.be/jUgC8AF2ZoY

https://youtu.be/CWVcjN5Wg-I

Those are good for starting to understand how mocha thinks. I'm going to link part 2 (only) of a three part tutorial here. Part 1 is creating an energy ball, part 3 is compositing into the tracked footage. Part 2 covers the mocha tracking, but also shows how to track an OBJECT in mocha after solving the camera. Also in this tutorial Axel mentions mocha wants a large spline to track and a small surface. That's actually a really important tip - when possible (for your castle you kinda have to track and surface the whole wall, but the ground and mountains can be big spline/small surface).

https://youtu.be/dtZN0WvZg9Y

• edited August 2

Thabk you so much I will watch these on repeat

• edited August 3

Anther Mocha question. I just had a successful track of the side of the building where there was some poster. It was rock solid and I was gonna corner pin it but when  imported into hitfilm my tracked rectangle shape is significantly smaller than  original poster I was tracking. Still rock solid but just as if shrunk in scale so it occupies a middle of the poster rather than covering the whole image.  Why would scale change and is there a way to fix or avoid that? Thank you

EDIT : Scratch that. My bad , my blue rectangle inside the splines was too small and I didnt see that.

• Howdy vanya_k , If you want to do this in Hitfilm super easy, I'm the guy that created the technique expressed in those other videos posted above by others.

Blender Tut from 2012, cam to world orientation at 30:33 mark.

Mocha Tut from  2012, cam to world orientation at around the 28:00 mark.

Tut from 2013 for Converting a Blender camera to Pixels for importing into Hitfilm.

2 Tuts from 2013 and 2014 for exporting an animated curve/vector path from Blender to Hitfilm.

Hitfilm Foundry Tut from 2017, cam to world orientation, super fast with no audio.