---
title: "Fill gaps automatically"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737634/Fill%20gaps%20automatically"
format: markdown
---
Shogun Post offers automatic gap filling using either a rigid fill operation or a kinematic fill. Automatic gap filling can produce gap filling for entire takes that is as good as (and sometimes better than) occlusion fixing. You can run these gap-filling methods when processing x2d files or using other processing combinations.

Shogun provides these ways to use auto-fill:

> Macro (toc)

> Macro (scroll-pagebreak)

> Macro (anchor)



## Auto-fill from the Marker Editing panel

From the Marker Editing panel, Shogun Post enables you to automatically fill gaps using a rigid fill operation. This looks at all the markers in your scene and then compares them against the marker you are trying to fill. It then uses a combination of similarly moving markers to fill the gap. Finally, it checks the fill to make sure it looks correct and if not, it chooses another set of markers.

This process is also available via scripting, using the [selectMarkersForRigidFill](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253737262) command to select the markers and the [autoFillGaps](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738682) command to fill them. For information on these commands, see *HSL scripting with Vicon Shogun*. 

### Auto-fill a selected marker

The following procedure for rigid gap filling is semi-automated, in that you choose a marker for the fill:

1. In the **Marker Editing** panel, ensure **Editing Tools **is selected, expand the **Fill Gaps** section and in the **Fill Rigid** area, select **Auto-select markers for fill**.
  To change the default options for auto-selection, click the **Show Options** button next to the check box. The options are:
  - **Max Deviation**: Specifies in mm how rigid the set of markers used to fill must be, as the maximum deviation in distance between all pairs in the set. For example, a value of 60 (the default) enables the markers to flex in rigidity by 6 cm.
  - **Max Distance**: Specifies in mm how far away the candidate can be from the selected marker. The default of 900 is just under 3 feet (1 m), because a greater distance is likely to be another subject or body part, which is unlikely to move rigidly during the gap.
  - **Percent Time Rigid**: Specifies the percentage of time over the adjacent fragment ranges that the selected marker must be rigid with the chosen set. The default of 0.75 means 75% of the time.
2. Select a marker with a gap.
3. Ensure the current time is in the gap.
4. Click **Fill Rigid**.
  Gaps are filled using the intelligent rigid fill.

### Auto-fill selected markers or all markers

In addition to the semi-automated procedure described above, you can also automatically fill all gaps on either all markers, or only those currently selected. To do this:

1. Depending on which markers you want to fill, make the appropriate selection:
  - **Only selected markers**. Ensure you have selected the required markers.
  - **All markers**. Ensure no markers are selected.
2. In the **Marker Editing** panel, ensure **Editing Tools **is selected, expand the Fill Gaps section and in the **Fill Rigid** area, select the **Current Frame**, **Selected Ranges** or **All Time** option.
3. Select **Auto-select markers for fill** and ensure the options are as required (see above).
4. Click **Fill Rigid**.
  All gaps on the selected markers, or on all markers if no markers are selected, are filled over the play range, or selected ranges.
  Note that in the case of all markers, only labeled markers are filled, though unlabeled markers can be auto-selected for filling the labeled marker.

> ℹ️ **Note**   
> ℹ️ After running automated gap filling, if Shogun Post did not find a set of rigid markers based on the settings, you may find that not all gaps are filled. You can either fill the remaining gaps manually, or you can try changing the settings, specifically by increasing **Max Deviation** from the default.

> Macro (16dcb1b2-c6fb-4c23-a096-38455b87e6a8/1fa5e51a-a28e-46e1-9b5c-734b339f025f/static/scroll-pagebreak)

You can run automated gap filling multiple times to achieve the required results, in particular, when:

- After first run, it either made an unwanted fill or wasn't able to fill a gap due to a mislabel. Fix the mislabel and then run it again to fill the remaining gaps.
- After first run, it either made an unwanted fill or wasn't able to fill a gap due to the gap being too complex. Fill the gap manually, then run automated gap filling again to fill any remaining gaps. These can now can be filled due to more data being available.
- After first run, some gaps remain. Loosen the rigidity settings (see Note above) and run it again.

> Macro (scroll-pagebreak)

> Macro (anchor)



## Auto-fill from the Processing panel

To use automatic gap filling from the **Processing** panel:

1. In the **Processing** panel, go to the **Settings** area and click the **Occlusion Fixing** tab.
2. In **Occlusion Fix Method**, select the required method: **Rigid** or **Kinematic**.
  Your choice is determined by the type of gap-filling required. For more information, see [Determine the appropriate gap-filling method](#gap-filling-method).
3. Click **Run Checked Operations**.

 > Macro (anchor)



### Determine the appropriate gap-filling method

Choose the most appropriate type of gap filling for your needs:

- **Kinematic **occlusion fixing uses the solve of the labeling skeleton and its constraint offsets to predict marker position and fill gaps. This option is suited to cases when enough of the subject is labeled that the skeleton can solve reasonably well. The settings are:
  - **Apply Fills to Markers**. Applies gap filling to markers in the current scene. If cleared, no markers are gap-filled, even if Fix Occlusion is selected and runs during processing. Default is selected.
  - **Backup**. Saves a backup of the data before gap filling is applied. Default is selected.
  - **Trajectory Smoothing**. Enables you to specify the level of smoothing applied to marker trajectories. Range is 0–1. Default is zero. For smoother trajectories, select higher values.
  - **Transition Time**. Transition time in seconds at the boundaries of a gap. Default is 0.1. For smoother trajectories, select higher values.
  For related HSL commands, see [setOcclusionFixMethod](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253740701) and [kinematicFixOcclusionOptions](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253738074) in *HSL scripting with Vicon Shogun Post*.
- **Rigid** occlusion fixing provides automatic smart rigid gap filling. This looks at all the markers in your scene and compares them to the marker you are trying to fill. It then uses a combination of similarly moving markers to fill the gap. Finally, it checks the fill to make sure it looks correct and if not, it chooses another set of markers. The settings are:
  - **Backup**. Saves a backup of the data before gap filling is applied. Default is selected.
  - **Max Deviation**. Specifies in mm the maximum deviation in distance between the rigid markers that are used for gap filling. For example, the default value of 60 enables the markers to flex in rigidity by 6 cm.
  - **Max Distance**. Specifies in mm the maximum distance between the rigid markers used for gap filling. The default value of 900 is just under 3 feet (1 m), because a greater distance is likely to be another subject or body part, which is unlikely to move rigidly during the gap.
  - **Percent Time Rigid**: Specifies the percentage of the time range being filled that the markers used for gap filling must be rigid. Range is 0–1. The default of 0.75 means the markers used for gap filling must be rigid 75% of the time.
  For related HSL commands, see [setOcclusionFixMethod](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253740701) and [rigidFixOcclusionOptions](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253739596) in *HSL scripting with Vicon Shogun Post*.