Utility Ruler - multiple purpose tool
A ruler. A protractor. A Point Calculator. Draw Lines. Draw Rectangles. Underline text. Create your own display effects.
This effect calculates the X and Y coordinates of the ruler’s end point (Ruler Length) using basic trigonometry. The special section below will provide math examples to achieve extreme precision.
This effect will work accurately for any resolution. It can be set up with a “Project V Res.” of 100 to calculate distances as percentages. If you’re using this with a Grid, you can set the resolution to the number of (row) grid lines.
Coordinate positions can be referenced from mid-screen or the lower left corner of a clip.
The actual vertical resolution of any clip can by overridden with the Project V Res parameter. It is set to 1080 by default, but it can be any value!
In the following formulas, the Aspect Width (AW) is determined by the actual Aspect Ratio of the clip TIMES the provided Project V Res (vertical resolution). If your clip is 16:9 1080, it’s AW is 1920. If the clip is 9:16 1080, it’s AW is 608.
It was not possible to arrange to have translated numeric values in the Effect’s parameters, so an on-screen info display was made available:
The top value is the Angle followed by the (translated) Distance between the Start and End of the Ruler. Up to 10 decimal digits are available where precision is required.
Shown: the specific values for an HD screen diagonal measurement (in pixels). Ruler Start is the Lower Left Corner and Ruler End is the Upper Right Corner coordinates on a 1080 screen.
The Distance (on screen) is the translated value of Ruler Length. If you need an exact value for the Distance, then the Ruler Length can be manually set by:
Ruler Length = (Distance + 0.5*AW)/AW;
[ Actual Distance formula is Distance = √(X² + Y²) ]
As an example, if you need to display 2203 for the distance, then the value needed to be entered into Ruler Length would be:
(2203 + 960) ÷ 1920 = 1.647395833333
(You may need to use your phone calculator if you need more precision and you may need to enter 12 or so decimal places!!).
This effect only uses Horizontal coordinates and simple subtraction to calculate the distance between Ruler Start and Ruler End.
This effect accurately calculates the sin and cos values needed to convert the Angle and the Distance into X and Y coordinates for the Ruler’s End.
One last formula:
Distance = (Ruler Length – 0.5) * AW
A note about the Ruler Length parameter: Final Cut Pro will not remember it with more than 4 decimal places of precision even though up to 16 decimal places can be used while using the Effect.
Project V Res: Set your own resolution!
Center Coords: offers the ability to set center screen as the origin, otherwise the origin is the lower left corner of the media.
Decimal Coords: will turn on 1 decimal place resolution (partial pixels/rounding).
Normalize Angle from: the default is the angle is measured from the left along the horizontal distance. Option “Top”: the angle is measured from the vertical distance downward. “Right”: the angle is measured from the right leftward along the horizontal and “Bottom”, the angle is measured along the vertical upwards.
Measure Angles allows you to change the direction of measuring from Counter Clockwise to Clockwise.
Ruler Start corresponds to the OnScreen Control with the “handle”.
Ruler Length is the measure of the distance between the two OnScreen Controls in “aspect ratio” space. A same value will represent different actual pixel distances across clips that have different aspect ratios. The math is performed and the value translated to the Distance on the Info panel in the Viewer (when visible).
Ruler Width: this value can be set to any size, including more than the “whole screen”. This setting allows Utility Ruler to be used as a visual effect.
Angle: because of the way this effect was built, the angle must be 180º (opposite) to the calculated angle displayed in the Info panel. (This will occasionally be inconvenient.)
Ruler Color and Opacity: typical use.
Ruler Blend: this is where this effect gets interesting. Screen Splits and similar special effects are achieved by setting this value to Stencil Alpha and Silhouette Alpha. Color corrections and other special effects can be accomplished with any of the other modes. Behind can also be particularly powerful!
The Precision options: allows you to set the number of decimal places available in the Info panel.
Unchecking Show Info will remove it from the screen. You may also use the Info Opacity to set visibility.
About this effect:
This effect is 100% Motion built. No external FxPlug plugins which means that when Apple upgrades the software, or hardware, this effect will not break (as just about everything at FxFactory, PixelFilm Studios and MotionVFX will do.)
This effect uses undocumented techniques that nobody else, basically, has any clue how to do. This effect is the most advanced Motion template I’ve ever built even if it is something as simple as drawing a line.
About Aspect Ratio compatibility
Most of the recent templates built here have cross-aspect ratio compatibility, meaning that you can copy/paste effects onto any display aspect ratio clip and it will just work without adjustments in the new-sized clip.
Due to the nature of this effect, the Angle is always preserved. In other words, you cannot build a “clip diagonal” effect and have it apply in a different aspect ratio clip. However, the Ruler Length setting will automatically adjust (horizontally) with respect to the new aspect.
Going from aspect ratio to aspect ratio will require making adjustments if the angles measured are determined by the aspect ratio. Other angle types, for example a text slant measure or text underline are preserved.