Article: Custom Camera Tutorial – Understanding the Hermite’s Legacy

From 50MB to 1GB in 3.2 seconds! The TMU Blog has been upgraded with more space for even more pictures to fill your world of TM.

But what does that have to do with todays article, written by Alcator? Absolutely nothing! So here it comes: A tutorial on how to make better creations using the MediaTracker! Did I mention it was written by Alcator?

If you’re working with the MediaTracker editor, you have undoubtedly come across the “Camera – Custom” type of blocks/tracks. I’ll refer to them as CC blocks in order to differentiate from the racing “track” itself.

When you add a Custom Camera block to a clip, you have multiple ways of adjusting it. Let’s first go through the settings and their possible values, before we delve into the depths of Linear, Hermite, Fixed tangential and None interpolation.

The following settings are adjusted by choosing one of several possible options:

The first three settings – Keep playing, block start and block end – are common to all blocks of all types, so we’re not going to describe them here.

Target – This setting has “None” as one option and then the names of all the loaded replays/ghosts as other options. If the view is targeted at a particular player, that player stays in the center of the view at all times.

Anchor – This settings has the same options as Target, but has different meaning (of course): If the camera is not anchored to any car, its position is set in absolute coordinates (i.e., from one of the corners of the map); if it is anchored to a car, then that car, no matter what its current position is, becomes the point “[0,0,0]”, and the camera position is set relative to the car.

AnchorVis – Anchor visibility setting is an obscure setting that I have no idea about right now and would appreciate anyone knowing what it is to clarify 🙂

AnchorRot – Anchor rotation only makes sense if you’re anchored to some particular car. If it is NOT checked, the car is the point [0,0,0], but the Axis X, Y and Z keeps the direction (orientation) of the world coordinates. If Rotation IS anchored, then the front-to-back axis of the car becomes the Z-axis (length), the left-to-right axis of the car becomes the X-axis (breadth), and the driver’s head-to-driver’s bottom axis becomes the Y-axis (height); this also means that if the car is going directly up (loop? aerial stunt?), if rotation is anchored, the “height” is for that particular moment a “horizontal” dimension.

Interpolation – this determines the way the camera moves between keys if the coordinates of the camera in them (or in neighboring keys) are not the same. This will be the main topic of this article. The options are: Hermite (default), Linear, FixedTangent and None.

Below these settings are several numerical settings that can be used for finetuning the position. Please remember that keyboard is also the only way to set certain values – such as the “Fov” (Field-of-vision) setting, which can be changed using the mouse wheel, but only in the range of 10 to 100 degrees, while keyboard input allows values 1 to 175.

X, Y and Z are, quite obviously, the coordinates in the current coordinate system (either absolute or relative if anchoring is chosen).

Pitch is the down or up angle of the camera: values 0 to 179 mean the camera is looking down (91 – 179 meaning the view is slightly up-side-down) , while negative values mean it’s looking up (with -91 to -179 once again meaning up-side-down view); if the Pitch is greater than 180 or less than -180, the angle is the same as if you added/subtracted 360 degrees (although it doesn’t mean you can just add/subtract 360 degrees and get the same results!).

Yaw: Imagine a compass on the ground; the angle the compass shows can be described as Yaw. By changing Yaw, you are turning the view left and right.

Roll is the angle of rotation along the axis defined by the Pitch. The standard values are 0 to 360, with any other values having the same meaning as the corresponding value in this range (-10 = -10+360 = 350 etc.). Value of -180 or 180 means the view is up-side-down.

Fov: Field of vision – the angle between left edge of the view, the camera position, and the right edge of the view; this is easily mistaken for “Zoom”, as it has almost the same effect as Zoom for values in 30 – 100 range; however, it’s NOT zoom. Once the value goes over 90 (give or take), a fish-eye-effect can be seen: Straight lines become rounded (curved), angles become distorted etc.

The big thing: Hermite interpolation

To understand the benefits of hermite interpolation, I advice you to first try Linear interpolation. Let’s use this track for learning:

Hermite Demotrack Click to enlarge.

This simple track is driven in approximately 10 seconds using the yellow path. If you put a single custom camera block in the replay clip that is launched on start, with start key right above start, end key right above finish (at time 10 seconds) and one “between” key above the purple dot in the turn, and set the Interpolation method of all 3 keys to Linear, this is what happens: The custom camera moves from start to the turn at constant speed, at a perfect straight line. Once it gets there, it immediately starts moving towards finish, once again at a constant speed and at a perfect straight line. As a result, in the turning point the view “jumps” from one direction to another, which doesn’t look very nice.

If you turn the interpolation method from Linear to FixedTangent, the path of the camera doesn’t change (!), but the speed does: The camera starts very slowly, accelerates, starts slowing down somewhere between the first two keys, comes to the turning point at minimum speed, and then starts accelerating towards finish. This way, there’s no unpleasant “jump”.

Both Linear and FixedTangent interpolation methods only take into account the two keys in question (i.e. the key the camera moves from and the key the camera moves to). Not so the Hermite interpolation!

Let’s now change the method to Hermite:

Hermite Complete Click to enlarge.

First, the colors: The three purple dots are the same as in first picture, and show the positions of the camera in the 3 keys (start, middle, end).

The two small red dots are points through which the camera moves if the interpolation method is Hermite – they are the moments when the camera is farthest from the direct line between the key positions. The yellow line shows the camera movement, and the two white lines are two hermite curves that I added as an approximation (explained later).

What is Hermite interpolation? “Hermite curve” is somewhat similar to Bezier curve from advanced 3D programs, or to the “curve” function of Microsoft Paintbrush. Each of these programs approaches the creation of the curve in a different way, but the base is this:

Hermite curve is defined by several points through which it MUST pass, and the mathematical representation of the curve dictates that the movement through the curve must be “smooth” – no obvious angles.

Hermite Curves Click to enlarge.

Here are several Hermite curves – notice the added lines and how the curve “touches” them exactly in the key points.

Also notice at the bottom-most picture that although the two points on the left are on the same “level” (height), the curve goes slightly below that level before it starts its ascend towards the third point. This can be very well observed in-game if you use a multi-key custom camera at a long straight that ends with a curve or chicane – if two or more keys go along the straight and then there’s a turn, the camera moves slightly away from the straight road so as to prepare for the turn at the end. To balance this “feature”, you may need to place the key that’s at the beginning of the turn slightly closer to the turn.

Important thing about Hermite interpolation: The speed of movement between two keys is constant; this means that if the distance the camera has to travel between them is different from the distance between the next two keys, while the time to travel that distance remains the same, the camera will suddenly speed up or slow down at the middle key. In the picture above, the track takes 10 seconds to complete, but the turning key is not placed at 00:05 seconds; instead, it comes a bit sooner so that the longer path (from turning point to finish) has longer time.

Tips for working with Hermite-interpolated Custom cameras:

  1. In order to make the camera move at (almost) constant speed, don’t place any keys between the start and end of the block at first, and adjust the full block’s length so that the camera reaches the end when the car being shown does. When that is done, play the block slowly (the camera moves on a straight line) and place keys at the moments that are nearest to the places where the camera should “turn” (such as the turning point in my demotrack). When that is done for all turning points along the way, position the camera at those key moments as you want; this will give you a very good material for final adjustments.
  2. Keep in mind that while the camera moves at constant speed, the cars have a bad habbit of accelerating and slowing down. So even if you see the car next to you at CC block’s start and next to you at CC block’s end, it doesn’t mean the car will stay next to you throughout the clip – this is especially true on start, after sharp turns or near boosters, which change the speed dramatically. Such places are ideal for the use of Anchored camera (and quite often, you won’t need Hermite interpolation at all).
  3. If you want the camera to stay at some particular point for a while and then continue moving, don’t place two keys at that point – the camera WILL move between them (see the middle curve on the schematic picture above); instead, make one CC block that ends when the camera gets to that waiting point, then place another block with “None” interpolation for the waiting period, and then place another CC block for the phase when the camera leaves the point (it will be a multi-block track of the clip). Read the article “Shoting Videos In United Part 2” about shooting videos if you don’t know how to make multi-block camera tracks in clips, it’s explained in the “I got the replays, now WHAT?“ part of that article.
Advertisements

8 Responses to Article: Custom Camera Tutorial – Understanding the Hermite’s Legacy

  1. insane says:

    wonderful article again 😉
    especially the tips were quite helpful, you do them most of the time subcounciously, but it helps alot to think about them for once
    hoped you could explain what that AnchorVis feature is all about, but oh well, seems its nadeo’s secret still 😛

  2. JumperJack says:

    great artice!! 😀

    this time i knew already many things, but i’ve learned some new things too!! 😉

  3. alcator says:

    This topic will be enhanced in the near future (let’s say during the next month) by another follow-up article, I’m determined to run some heavy tests to detect that AnchorVis stuff and also to clarify some other stuff.

    Thanks for the feedback, guys!

  4. T_Z_ says:

    Nice article Alcator, I’m a big noob at those things, specially at that hermite thing, I always used linear and fixed tangent, had no idea between linear and hermite 😛

  5. Tonic_91 says:

    Wonderful article again 🙂
    I didn’t know that about the FixedTangent, I think it’ll be of use 😉

  6. Dutchman says:

    Great work again!

  7. RooBah says:

    Good stuff, and yes much is known about it but it is always good to see one persons take on how it works.
    I would like to see how to add an image (with transpaency) to this. I am not talking about using the opacity slider!
    Other notables:
    Fixed Tangent

  8. Magonator says:

    why, when I try to change ANY ONE of these settings, when I click play it reverts back to the default setting?!?! It’s so frikking annoying! I can’t change any setting!!!! what the hell?!?!?!?!?!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: