user: Explain Selection Masking in complete detail according to the official Blender documentation.

assistant: If you have a complex mesh, it is sometimes not easy to paint on the intended vertices.
Suppose you only want to paint on a small area of the Mesh and keep the rest untouched.
This is where “selection masking” comes into play. When this mode is enabled,
a brush will only paint on the selected vertices or faces.
The option is available from the header of the 3D Viewport
(see icons surrounded by the yellow frame):

[image reference removed]

You can choose between *Face Selection masking* (left button), *Vertex
selection masking* (middle button), and *Bone selection* (right button). The
latter is only available when the mesh has an Armature modifier.

Selection masking has some advantages over the default paint mode:

- The original mesh edges are shown, even when modifiers are active.
- You can select and deselect faces instead without the need to switch to Edit Mode.

### Details About Selecting

The following standard selection operations are supported:

- `Alt`-`LMB` – Single faces
- `Shift`-`Alt`-`LMB` – Select more or remove them from the selection.
- `A` – All faces, `A` `A` to deselect.
- `B` – Box selection.
- `C` – Circle select with brush.
- `Ctrl`-`I` – Invert selection.
- `L` – Pick linked (under the mouse cursor).
- `Ctrl`-`L` – Select linked.
- `Ctrl`-`NumpadPlus` – Extend Selection
- `Ctrl`-`NumpadMinus` – Shrink Selection

The following only work for face selection and with the selection tool active:

- `Alt`-`LMB` – Loop Select

### Vertex Selection Masking

In this mode you can select one or more vertices and then paint only on the selection.
All unselected vertices are protected from unintentional changes.

[image reference removed]

Vertex Selection masking.

### Face Selection Masking

The *Face Selection masking* allows you to select faces and limit the paint
tool to those faces, very similar to Vertex selection masking.

[image reference removed]

Face Selection masking.

### Hide/Unhide Faces

[image reference removed]

Hidden faces.

You also can hide selected faces as in Edit Mode with the keyboard Shortcut `H`,
then paint on the remaining visible faces and finally unhide the hidden faces again by using
`Alt`-`H`.

### Hide/Unhide Vertices

You cannot specifically hide only selected faces in vertex mask selection mode.
However, the selection is converted when switching selection modes.
So a common trick is to:

1. Switch to Face selection mask mode to have the selection converted to faces.
2. Refine your selection next or just hide the faces.
3. Switch back to Vertex Selection mask mode.

Hiding faces will make sure that vertices that belong to visible faces remain visible.

### The Clipping Region

To constrain the paint area further you can use the *Clipping Region*.
Press `Alt`-`B` and `LMB`-drag a rectangular area.
The selected area will be “cut out” as the area of interest.
The rest of the 3D Viewport gets hidden.

[image reference removed]

The Clipping Region is used to select interesting parts for local painting.

You make the entire mesh visible again by pressing `Alt`-`B` a second time.

All paint tools that use the view respect this clipping, including box select, and of course brush strokes.

There are two helpful reminders that a Clipping Region is used:

1. The clipping region is drawn as a gray box in the 3D Viewport
2. The Text Info overlay will state that the perspective is “Clipped”