Patch Editor

 

Overview

 

Patch nodes (or Patches) such as Rect, Bezier, PerspQuad, and others (see the full list of patch nodes) are designed to apply various types of image* geometry correction (warping), transformation, arrangement, and mapping. Extensive control for the patch management is provided in the Patch Editor tab of the Screenberry Panel. In addition, most operations with the patches can be performed directly from a computer keyboard connected to the Server.

*The term “image” refers to any static or dynamic media (i.e. video).

Patch Editor View

The Patch Editor view: (1) Context Area selection, (2) Patches List, (3) Patch Settings, (4) Work Area which is split into two parts: (A) Geometry Layout Area, and (B) UV Layout Area. Тo zoom in and out a specific area in the Geometry Layout Area or UV Layout Area of the Patch Editor, move the cursor to the desired location, and use the mouse scroll wheel. Alternatively, click the button in the top right corner and move the mouse to the left or right to change the magnification. To pan a view, hold the mouse scroll wheel button or click the  button in the top right corner and move the mouse.

Adding a Patch

Patch nodes are added in the Node Graph (see Adding Nodes). In a typical setup, a patch node is connected to the source image node on the input and the Display or Context node on the output.

The BezierPatch receives input from the Media Player and sends output to the Context

Deleting a Patch

To delete a patch, right-click on the patch name in the Patches List and select Delete Patch from the drop-down menu, or delete the patch node in the Node Graph.

Editing Patches

Selecting a Patch for Editing

To select a patch for editing do one of the following:

  • Right-click on the patch node in the Node Graph and select Edit Patch from the drop-down menu.
  • Click on the patch name in the Patches List of the Patch Editor

To switch between patches, do one of the following:

  • Press the Z key to go to the next patch, or press Shift + Z to go to the previous patch, 
  • Right-click in the Patch Editor work area and choose Select Next Patch or Select Previous Patch from the drop-down menu.

When a particular patch is selected, its Settings panel opens to provide control over its parameters. If the Settings panel was previously closed, it can be turned on in Window/Settings.

Multiple patches can be selected at once by Ctrl-clicking or Shift-clicking on the patch names in the Patches List.

Modifying Image Geometry with Control Points

In the Geometry Layout Area, select and drag the circular handles of the mesh control points to change the image geometry.

Multiple control points can be selected at once by Shift-clicking them one by one, or left-clicking and dragging a marquee selection box around them.

Note:
It is recommended to have visual control over Screenberry output while making adjustments.

Adjusting UV Mapping

In the UV Layout Area,  select and drag the circular handles to modify the control point coordinates of mapping mesh for the source image.

Note:
The mapping mesh should not extend beyond the edges of the source image.

Setting Control Points Coordinates

To show control points coordinates, press the Spacebar, or right-click in the Patch Editor work area and select Show Coordinates from the drop-down menu.

To change control point coordinates manually, select the control point and press the Enter key, or right-click on the control point and select Set Position from the drop-down menu. Enter X and Y coordinates in the dialog window.

Note:
The coordinate origin (0,0) is located at the top-left corner.

Flipping and Rotating the Patch Indexes

You can apply a vertical flip or 90 degrees clockwise rotation to the source media in the Geometry Layout Area, or to a UV selection in the UV Layout Area. To flip, select a control point and press F key, or right-click on a control point and select Transform>Flip from the drop-down menu. To rotate, select a control point and press R key, or right-click on a control point and select Transform>Rotate Indexes from the drop-down menu.

Note:
Selecting a control point when flipping or rotating the image helps to understand which transformation has been performed in relation to geometry and UV layouts.

Modifying Density of a Mesh Grid

You can change the density of the mesh grid to achieve more control over the image geometry correction.  

To change the mesh grid density, use the related keyboard shortcut, or right-click in the Patch Editor work area and select Grid/[Function] from the drop-down menu.

Available functions and related keyboard shortcuts:
Subdivide (Ctrl + X) splits the edges and faces by cutting them in half, and adding new vertices.
Merge (Ctrl + Shift + X) combines the neighboring polygons by removing their shared boundary.
Subdivide Columns (Ctrl + Shift + Right) splits the edges and faces of all columns by cutting them in half, and adding new vertices.
Merge Columns (Ctrl + Shift + Left) combines the neighboring polygons of all columns by removing their shared boundary.
Subdivide Rows (Ctrl + Shift + Up) splits the edges and faces of all rows by cutting them in half, and adding new vertices.
Merge Rows (Ctrl + Shift + Down) combines the neighboring polygons of all rows by removing their shared boundary.

Guidelines

When the position of the control points is edited, the green dotted horizontal and vertical smart guides are displayed. They provide a visual reference to the previous coordinates of the control point and help with its alignment along the prior axes.

In addition, when the position of the control points for the Rect patch in the Geometry Layout Area is modified, the diagonal white dotted smart guide, which corresponds to the aspect ratio of the source image based on its UV coordinates, is also displayed.

To add custom guidelines, right-click in the Patch Editor layout area and select Guideline Editor from the drop-down menu. In the dialog box, do one of the following:

  • Create the guideline grid by entering the number of Columns and Rows and pressing the Add Grid button.
  • Add individual guidelines by entering their coordinates and pressing the Add Horizontal Guideline or Add Vertical Guideline buttons. 

Press the Clear All button if you want to remove all guidelines.  After the guidelines setup is finished, press the OK button to add guidelines to the layout area.

Snapping

By default, the automatic snapping option is enabled. When you change the position of a control point, it snaps to the guidelines, smart guides, output canvas edges, and other control points if placed near them. To disable snapping temporarily while dragging a control point, hold down the Shift key.

Vertical and Horizontal Alignment of the Control Points

To align the selected control points horizontally press Shift + H or right-click on the selected control points and choose Align Horizontally from the drop-down menu.

To align the selected control points vertically press Shift + V or right-click on the selected control points and choose Align Vertically from the drop-down menu.

 

While editing, you can also constrain the movement of the control points:

  • To the horizontal axis by pressing the H key or right-clicking on the control point and selecting Constrain Horizontally from the drop-down menu. 
  • To the vertical axis by pressing the V key or right-clicking on the control point and selecting Constrain Vertically from the drop-down menu. 

 

Setting the Background Image

Setting the background image provides visual cues for the finer positioning of control points. Selecting the layout area and pressing the F5 key sets / refreshes the background image to the following:

  • In the Geometry Layout Area – the snapshot of the current video output of the media server.
  • In the UV Layout Area –  the snapshot of the source feed received by the patch.

Pressing Shift + F5 removes the background image.

To set the uploaded file (for example, the photo of the object the warping is applied to) as a background image, press Shift + F5 or right-click in the Patch Editor work area and select Set Background Image from File from the drop-down menu.

Selecting a Display Mode for the Output

You can select one of the three available display modes by choosing the View Mode parameter in the Settings panel of the patch:

  • Texture shows the output image only.
  • Texture + Grid shows the output image and mesh grid (red lines).
  • Texture + Subdivided Grid shows the output image, mesh grid (red lines), and subdivisions of the warping grid (grey lines).

Example of the PerspQuad patch output in Texture mode

Example of the PerspQuad patch output in Texture + Grid mode

Example of the PerspQuad patch output in Texture + Subdivided Grid mode

Changing the Number of Grid Subdivisions

The overall smoothness of the output image (the result of warping applied by the patch) can be improved by increasing the number of the mesh grid subdivisions. This results in a finer warping grid.

You can change the number of subdivisions by entering a value for the Subdivisions parameter in the Settings panel of the patch. The maximum value is 256, the minimum is 1, and the default is 5.

An example of how changing the warping grid subdivisions from 5 to 20  improves the smoothness of the output image

Note:
The number of subdivisions determines the warping grid density. A higher grid density increases warping precision but requires more processing time, a lower one does the opposite.

Selecting the Interpolation Algorithm

You can choose the Linear or Nearest-neighbor interpolation algorithm for translating pixel values of the patch by selecting the Scaling Algorithm parameter in the Settings panel of the patch.

Changing Patch Opacity and Edge Transparency

To change the patch opacity, enter a value for the Opacity parameter in the Settings panel.

To feather the edges of a patch, enter the number of pixels for the Fade-out source edges parameter in the Settings panel of the patch.

Applying Transformations to the Patch

Various transformations can be applied to the patch by using the transformation matrix. Click the Edit Matrix button for the Transform parameter in the Settings panel of the patch to edit the matrix values.

Examples of transformations:

sx000
0sy00
0010
0001
Scale:

sx specifies the scale factor along the x-axis.

sy specifies the scale factor along the y-axis.

1000
0100
0010
txty01
Translation:

tx specifies the displacement along the x-axis.

ty specifies the displacement along the y-axis.

1shy00
shx100
0010
0001
Shear:

shx specifies the shear factor along the x-axis.

shy specifies the shear factor along the y-axis.

100tx
010ty
0010
0001
Tilt:

tx specifies the tilt factor along the x-axis.

ty specifies the tilt factor along the y-axis.

Using the GridImage Node as a Test Pattern

For more efficient and convenient patch editing, it is recommended to use the GridImage node connected to the patch node as the source image.

The GridImage node generates a test grid pattern that can be modified using various parameters in the node settings.

A default test grid pattern generated by the GridImage node

Restoring Patch Default Settings

To restore the default settings of a patch, right-click on the patch name in the Patches List and select Reset Patch from the drop-down menu.

Using Keyboard Shortcuts to Edit Patches

Keyboard shortcuts can be used for more effective patch editing. If necessary, manual calibration can also be performed directly on the Server, without using the Screenberry Panel, and requires only a keyboard connected to the Server computer.  Keyboard shortcuts list:

General operations
Enter/Exit calibration mode (Server shortcut only)Ctrl + C
Open help screen with the keyboard shortcuts list (only F1 works in the Screenberry Panel)H or F1
UndoCtrl + Z
RedoCtrl + Shift + Z or Ctrl + Y
Patch selection
Select the next patchZ
Select the previous patchShift + Z
Patch Editing Mode Selection
Switch to Geometry mode (the patch mesh lines are shown in red). Pressing G in Geometry mode shows / hides the subdivision grid.G
Switch to UV mode (the patch mesh lines are shown in green). U
Switch to Compensated mode (the patch mesh lines are shown in blue). This mode allows the editing of Geometry and UV simultaneously.Y
Show / Hide the subdivision grid for all patches (Server shortcut only)Space
Control points operations
Select a control pointArrow keys
Select faces inside the mesh (Server shortcut, the TriMesh patch  only)Ctrl + Arrow keys
Move control pointW, S, A, D
Move control point in smaller incrementsShift + W, S, A, D
Move all control points at onceCtrl + W, S, A, D
Scale all control points at onceAlt + W, S, A, D
Increase increment+ or =
Decrease increment or  _
Reset increment to the default value (1%)0
Rotate and flip operations
Rotate all control points clockwise around the selected control pointE
Rotate all control points counterclockwise around to the selected control pointQ
Rotate all control points clockwise around the selected control point in smaller incrementsShift + E
Rotate all control points counterclockwise around the selected control point in smaller incrementsShift + Q
Flip the image verticallyF
Rotate the image 90 degrees clockwiseR
Advanced operations
Change the direction of selected control point handle 90 degrees clockwise (Server shortcut only)Ctrl + E
Change the direction of selected control point handle 90 degrees counterclockwise (Server shortcut only)Ctrl + Q
Change the direction of selected control point handle clockwise in smaller increments (Server shortcut only)Ctrl + Shift + E
Change the direction of selected control point handle counterclockwise in smaller increments (Server shortcut only)Ctrl + Shift + Q
Reset patch geometryCtrl + R
Rebuild blending maps if the Blender node is connectedCtrl + B
Increase grid subdivisionCtrl + + (plus)
Decrease grid subdivisionCtrl + (minus)
Grid subdivision density modification
Increase grid subdivisionCtrl + X
Decrease grid subdivisionCtrl + Shift + X
Increase grid columns subdivisionCtrl + Shift + Right
Decrease grid columns subdivisionCtrl + Shift + Left
Increase grid rows subdivisionCtrl + Shift + Up
Decrease grid rows subdivisionCtrl + Shift + Down

Visual Examples of Using Keyboard Shortcuts on the Server

Selecting the Patch

Patch Editing Mode Selection

Selecting and Moving Control Points

Selecting Faces of the Patch Mesh (only for the TriMesh patch)

Moving and Scaling All Control Points of the Patch Mesh at Once

Changing the Editing Step Increment

Flipping and Rotating the Patch Mesh

Changing the Direction of the Control Point Handle

Modifying the density of the patch grid