Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Creating a Horizontal Scrolling Compass From a 3D Camera Tracker

Community Beginner ,
Jul 20, 2023 Jul 20, 2023

Hi,

 

I've been trying to make a compass which tracks the video's direction, and scrolls through a horiziontal compass image (attached).  

 

I tried to use a lerp/ease function to interoplate between 2 2d points of the image on the very left and right, based on the 3d tracker camera's orientation. That doesn't work, since the 360-0 jump is bad and inaccurate. I think a good solution would be to wrap the compass image around a 3d sphere and turn off the transformation for the 3d camera, but I'm not sure how to do that. 

 

Thanks,

Cooper.

TOPICS
Expressions , How to
418
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jul 20, 2023 Jul 20, 2023

You will have to set an Origin and Ground Plane on a surface that is on the ground, and you will have to know what the heading is from the Camera to the object. You will have to guess if you did not record that information when you started shooting.

 

The workflow would be to Track (Advanced analysis is almost always a good idea), Set an Origin and Ground Plane, and use the same Target to add a solid to the comp. When you have your Solid and your Camera added, go to the first frame of the comp,

...
Translate
Community Expert ,
Jul 20, 2023 Jul 20, 2023

You will have to set an Origin and Ground Plane on a surface that is on the ground, and you will have to know what the heading is from the Camera to the object. You will have to guess if you did not record that information when you started shooting.

 

The workflow would be to Track (Advanced analysis is almost always a good idea), Set an Origin and Ground Plane, and use the same Target to add a solid to the comp. When you have your Solid and your Camera added, go to the first frame of the comp, turn the Solid to a Guide layer, add a 3D Null to the composition, move the null to 0, 0, 0, Parent the Camera, and the Origin solid to the Null, then move the null back to comp center by using the Layer/Transform/Position reset option. The tracking should still work perfectly. If it does, delete the 3D Null you used to center the 3D world at the comp center.

 

Now you have a camera that is moving around the comp with a decent starting reference and heading, and the Origin and Ground plane layer you created should be exactly at the comp center. The camera will now fly around AE's 3D world, and the Y angle to the comp center should be 0º.

 

Verify that by looking at the top view. The "Origin" guide layer should be exactly in the center of the frame.  Camera tracker gives you a one-node camera, so you have a very handy Y value you can harvest to give you the compass heading for your camera. Centering the Track on the first frame keeps the camera right side up and lets you take the Y value + the angle offset to generate 0º to 360º data you can use to animate rotation or even position. 

 

If you want to turn Camera Y Orientation into a linear X movement, you will need a repeating compass graphic that is about 3 times as wide as the comp in a nested comp (a Pre-comp), with collapse Transformations turned on so when the Y orientation value goes from zero to 360 the graphic does not disappear.

 

An expression like this on the Pre-comp would give your something usable:

 

t = thisComp.layer("3D Tracker Camera").transform.orientation[1];
xOfst = linear(t, 360, 0, 0, width);
x = value[0] - xOfst;

y = value[1];

[x, y]

 

This is what a comp would look like:

RickGerard_0-1689888552045.gif

You can see the Pre-comp I made with two copies of your compass layer in the first few frames of the GIF. I just set the X anchor of one of the layers to zero and the other to the width of the graphic. 

 

If you don't go the first frame of the comp, add a 3D null after you have the camera tracked and added all of your solids (I don't add nulls because you can't see if they are good trackers) or added a 3D text layer, moved the null to 0,0,0, parented all of the 3D layers you created with the camera track to the null, and then reset the position of the 3D null to comp center, the Camera Y orientation may not be accurate because you can end up with a camera that is pointing almost straight down and it's hard to visualize the camera angle changes in multiple views. 

 

I added Grid to the Origin solid I added and made it a guide layer so I could see that the track was accurate and not have it render if I do not remember to turn off the layer.

 

The Y Orientation values won't change if you skip that step, but centering the camera track makes it a lot easier to add more 3D objects to the scene later. 

 

I also added a pointer and a 3D text layer that looks at the Y Orientation value with .toFixed(0) added to the expression to make it easier to see if your compass graphic is accurate. All you have to do to line up the graphic with the actual heading values is change the position of the nested comp. If you want digital accuracy with the text layer, just add the correction value to the expression.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 20, 2023 Jul 20, 2023
LATEST

Thanks so much for such a detailed and well thought out response!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines