user: Show practical ways to work with DisplaceModifier(Modifier) in a Blender add-on or script – include code.

assistant: # DisplaceModifier(Modifier)

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`Modifier`](bpy.types.Modifier.html#bpy.types.Modifier "bpy.types.Modifier")

*class* bpy.types.DisplaceModifier(*Modifier*)
:   Displacement modifier

    direction
    :   - `X`
          X – Use the texture’s intensity value to displace in the X direction.
        - `Y`
          Y – Use the texture’s intensity value to displace in the Y direction.
        - `Z`
          Z – Use the texture’s intensity value to displace in the Z direction.
        - `NORMAL`
          Normal – Use the texture’s intensity value to displace along the vertex normal.
        - `CUSTOM_NORMAL`
          Custom Normal – Use the texture’s intensity value to displace along the (averaged) custom normal (falls back to vertex).
        - `RGB_TO_XYZ`
          RGB to XYZ – Use the texture’s RGB values to displace the mesh in the XYZ direction.

        Type:
        :   enum in [`'X'`, `'Y'`, `'Z'`, `'NORMAL'`, `'CUSTOM_NORMAL'`, `'RGB_TO_XYZ'`], default `'NORMAL'`

    invert_vertex_group
    :   Invert vertex group influence

        Type:
        :   boolean, default False

    mid_level
    :   Material value that gives no displacement

        Type:
        :   float in [-inf, inf], default 0.5

    space
    :   - `LOCAL`
          Local – Direction is defined in local coordinates.
        - `GLOBAL`
          Global – Direction is defined in global coordinates.

        Type:
        :   enum in [`'LOCAL'`, `'GLOBAL'`], default `'LOCAL'`

    strength
    :   Amount to displace geometry

        Type:
        :   float in [-inf, inf], default 1.0

    texture
    :   Type:
        :   [`Texture`](bpy.types.Texture.html#bpy.types.Texture "bpy.types.Texture")

    texture_coords
    :   - `LOCAL`
          Local – Use the local coordinate system for the texture coordinates.
        - `GLOBAL`
          Global – Use the global coordinate system for the texture coordinates.
        - `OBJECT`
          Object – Use the linked object’s local coordinate system for the texture coordinates.
        - `UV`
          UV – Use UV coordinates for the texture coordinates.

        Type:
        :   enum in [`'LOCAL'`, `'GLOBAL'`, `'OBJECT'`, `'UV'`], default `'LOCAL'`

    texture_coords_bone
    :   Bone to set the texture coordinates

        Type:
        :   string, default “”, (never None)

    texture_coords_object
    :   Object to set the texture coordinates

        Type:
        :   [`Object`](bpy.types.Object.html#bpy.types.Object "bpy.types.Object")

    uv_layer
    :   UV map name

        Type:
        :   string, default “”, (never None)

    vertex_group
    :   Name of Vertex Group which determines influence of modifier per point

        Type:
        :   string, default “”, (never None)

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   type