Skip to content

Mask with AI

AI masks find things in the photo for you. Choose what to select, wait for the result, and edit only that part. DarkRay has five kinds: Subject, Sky, Select, Smart Select and Depth Range. This page covers the first three and the settings they share. The other two have pages of their own: Pick with Smart Select and Mask by distance.

Subject and Depth Range need a model you add yourself in Preferences › AI Models; none comes with DarkRay. Until you add one, their menu items read Needs a model…, and choosing one opens that page. See Bring your own model. The other three work as installed.

  1. Click the AI button next to Layer in the Layers pane. Hover over it to see its name. Its small arrow lists Smart Select, Subject, Sky, Select and Depth Range. The button itself repeats the last one you used.
  2. Choose a kind. The layer’s row shows “computing…” while the model works, and the status bar shows progress with a cancel button.
  3. When the result lands, it appears as a mask on the layer with the overlay turned on. Adjust the sections on the right.

To add an AI mask to an existing layer, right-click the layer, choose Add Mask (or Add, Subtract or Intersect), then the kind. See Use masks for how masks combine.

Example: a landscape with a Sky mask shown as a red overlay, then Exposure −0.8 and Color Grading toward blue on that layer

Only one AI job runs at a time. Others wait their turn and start when the one ahead finishes. Leaving the photo stops the job in progress.

Kind Selects
Subject The main subject of the photo, found by a Subject model you add (the first one you added, unless you choose another in Preferences › AI Models)
Sky The sky
Select One kind of thing from a fixed list: People, Hair, Face, Skin, Eyes, Lips, Teeth, Clothes, Animals, Bird, Dogs, Cats, Horse, Vehicles, Cars, Airplanes, Trains, Bicycles, Boats, Water, Foliage, Flowers, Grass, Buildings, Doors, Windows, Walls, Mountains, Ground, Sand, Snow, Road, Rocks

The row reads “Select: Hair” or the name of whichever you chose. You can’t type your own word yet; the list is fixed.

All three are refined along the edge at full photo resolution, so hair and branches against the sky usually come out cleanly. Select can still drop or merge small patches for some classes, such as Water and People. To fix that, combine it with a painted mask (see Paint a mask).

In the mask’s card, Expand grows or shrinks the selection and Feather softens its edge. Expand is useful for the thin rim of sky that hugs a branch.

DarkRay computes an AI mask one time, from the photo as the Base layer shows it at that moment, and saves the result. It does not run again on every edit. Changing the Base later does not update the mask, so if the photo changes a lot, add the mask again.

The saved mask follows your later geometry changes. If you change the lens correction, the mask stays on the same part of the scene. Cropping and rotating don’t disturb it.

The saved results live in the cache folder. They are never removed to stay under the cache size limit, but clearing that folder removes them.

If a saved mask is missing, the layer has no effect and the mask’s row reads “needs regenerating” in red. This happens after the cache is cleared, or after you paste edits onto another photo (a mask belongs to the photo it was made on).

  • When you open such a photo in Edit, DarkRay asks once per session whether to regenerate. Choose Regenerate, or Not now to leave it.
  • Image › Regenerate AI Masks does the same at any time for the photo you are editing.
  • Paste Edits onto another photo regenerates the pasted AI masks there without asking.

Only masks whose saved result is missing are redone. A Smart Select mask can’t be redone this way, because it doesn’t store your clicks. Its row reads “redo”. Delete it and select again.

AI masks run on an NVIDIA graphics card when you have one. Without one they run on the processor, which is slower [CHECK: no CPU timings found to cite]. On a card with 8 GB of video memory or more DarkRay picks the larger Smart Select model, and on smaller cards or no card it picks the lighter one. You can override this in Preferences › AI Models under Compute tier. The tier only affects Smart Select.

For a sense of scale, on an RTX 5070 refining the edge of a 46-megapixel photo with a long, ragged outline such as foliage takes several seconds.

Each model needs its weights on disk. If they are missing, the status bar tells you which mask is unavailable [CHECK: how a customer installs the model weights; today the status bar points to scripts/fetch_models.py].

Technical details: the models and how masks are stored

Each kind uses these models:

Kind Models
Subject A Subject model you add proposes the outline; none is built in
Sky SAM 3, prompted with “sky”
Select SAM 3, prompted with the class name
Smart Select SAM 2.1 (Large on the full tier, Small on lite)
Depth Range A depth model you add; none is built in

For Subject, Sky and Select, a matte then refines the edge in tiles at the photo’s own resolution. The proposal only has to place the outline; the matte decides the pixels along it. The matte is Closed-form, a classical method that uses no trained model. It gets hard edges right and handles hair and branches when they stand out from the background; low-contrast hair and haze come out softer or missing. You can add a learned edge matte of your own in Preferences › AI Models.

The model sees a full-resolution render of the photo with the Base layer’s edits and no lens correction. The result is stored as an image in the cache folder, in that uncorrected geometry, and your layer stores only a small description pointing to it. At render time DarkRay loads the image and warps it into the current frame, which is why a lens change doesn’t misplace it. No model runs during a render, so the render stays a fast, repeatable function of the saved edits.