user: How do I use Pack Islands in Blender? Include parameters, examples, warnings and best practices.

assistant: The *Pack Islands* tool can be used to optimize the UV layout by adjusting existing islands
to efficiently fill the [Texture Space](../../../glossary/index.xhtml#term-Texture-Space). Based on the options selected,
the tool will scale, translate and rotate the islands,
ensuring a specified margin exists between them to maximize the usage of the UV space.
Pinned islands can have additional restrictions applied to customize the packing process even further.

Shape Method
:   The method to use when considering the shape of each island.

    Exact Shape (Concave):
    :   Use the complete shape of the island, including filling any holes or concave regions around the island.

    Boundary Shape (Convex):
    :   Takes into account the boundary (Convex Hull) of the island.
        This method will not place islands inside holes.

    Bounding Box:
    :   Uses the simple bounding box of the island.

Scale
:   Scale the islands to fill the unit square, or pack islands towards the lower left corner.

Rotate
:   Allows the rotation of islands, as well as translation and scaling, to optimize texture usage.

Rotation Method
:   The allowable rotations to use for each island.

    Any:
    :   Any rotation which improves the packing is allowed.

    Axis-aligned:
    :   The island will first be rotated into a smallest rectangle.
        Additional rotation will only be in 90-degree turns.

    Cardinal:
    :   Like the four cardinal directions on a compass, North, South, East and West,
        only 90-degree turns will be allowed.

Margin Method
:   The method to use when calculating the empty space between islands.

    Scaled:
    :   Use scale of existing UVs to multiply margin.

    Add:
    :   Simple method, just add the margin.

    Fraction:
    :   Precisely specify the fraction of the UV unit square for margin. (Slower than other two methods.)

Margin
:   The scale for the empty space between islands.

Lock Pinned Islands
:   An island which has any of its UVs pinned is considered a *Pinned Island*.
    With this option, *Pinned Islands* will be unable to move. The other islands will pack around them.

Lock Method
:   Change the way *Pinned Islands* are packed

    Scale:
    :   The scale of the *Pinned Islands* will not change.

    Rotation:
    :   *Pinned Islands* will not rotate.

    Rotation and Scale:
    :   *Pinned Islands* can translate, but not scale nor rotate.

Merge Overlapping
:   Before the main packing operation, overlapping islands are detected and temporarily combined.
    During packing, the relative rotation and position of the merged islands are preserved.

Pack To
:   Determines the final placement of UV islands after completing the packing operation.

    Closest UDIM:
    :   Pack islands to the [UDIM](workflows/udims.xhtml) grid
        nearest to the center of the selection.

    Active UDIM:
    :   Pack islands to the active UDIM image tile or, if no image is available,
        the UDIM grid tile where the 2D cursor is located.

    Original bounding box:
    :   Find the original bounding box of the selection,
        packs the islands, and then moves them back inside the original box.

    Custom Region:
    :   Packs islands into a user-defined custom region set with
        [Set User Region](#bpy-ops-uv-custom-region-set).
        This allows packing islands into arbitrary UV areas, such as reserved atlas regions,
        trim sheet zones, or layout-specific texture slots.
        Requires [Custom Region](#bpy-types-toolsettings-use-uv-custom-region) to be enabled.