user: How do I use Material(ID) in Blender? Include parameters, examples, warnings and best practices.

assistant: # Material(ID)

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

*class* bpy.types.Material(*ID*)
:   Material data-block to define the appearance of geometric objects for rendering

    alpha_threshold
    :   A pixel is rendered only if its alpha value is above this threshold

        Type:
        :   float in [0, 1], default 0.5

    animation_data
    :   Animation data for this data-block

        Type:
        :   [`AnimData`](bpy.types.AnimData.html#bpy.types.AnimData "bpy.types.AnimData"), (readonly)

    blend_method
    :   Blend Mode for Transparent Faces (Deprecated: use ‘surface_render_method’)

        - `OPAQUE`
          Opaque – Render surface without transparency.
        - `CLIP`
          Alpha Clip – Use the alpha threshold to clip the visibility (binary visibility).
        - `HASHED`
          Alpha Hashed – Use noise to dither the binary visibility (works well with multi-samples).
        - `BLEND`
          Alpha Blend – Render polygon transparent, depending on alpha channel of the texture.

        Type:
        :   enum in [`'OPAQUE'`, `'CLIP'`, `'HASHED'`, `'BLEND'`], default `'OPAQUE'`

    cycles
    :   Cycles material settings

        Type:
        :   `CyclesMaterialSettings`, (readonly)

    diffuse_color
    :   Diffuse color of the material

        Type:
        :   float array of 4 items in [0, inf], default (0.8, 0.8, 0.8, 1.0)

    displacement_method
    :   Method to use for the displacement

        - `BUMP`
          Bump Only – Bump mapping to simulate the appearance of displacement.
        - `DISPLACEMENT`
          Displacement Only – Use true displacement of surface only, requires fine subdivision.
        - `BOTH`
          Displacement and Bump – Combination of true displacement and bump mapping for finer detail.

        Type:
        :   enum in [`'BUMP'`, `'DISPLACEMENT'`, `'BOTH'`], default `'BUMP'`

    grease_pencil
    :   Grease Pencil color settings for material

        Type:
        :   [`MaterialGPencilStyle`](bpy.types.MaterialGPencilStyle.html#bpy.types.MaterialGPencilStyle "bpy.types.MaterialGPencilStyle"), (readonly)

    is_grease_pencil
    :   True if this material has Grease Pencil data

        Type:
        :   boolean, default False, (readonly)

    line_color
    :   Line color used for Freestyle line rendering

        Type:
        :   float array of 4 items in [0, inf], default (0.0, 0.0, 0.0, 0.0)

    line_priority
    :   The line color of a higher priority is used at material boundaries

        Type:
        :   int in [0, 32767], default 0

    lineart
    :   Line Art settings for material

        Type:
        :   [`MaterialLineArt`](bpy.types.MaterialLineArt.html#bpy.types.MaterialLineArt "bpy.types.MaterialLineArt"), (readonly)

    max_vertex_displacement
    :   The max distance a vertex can be displaced. Displacements over this threshold may cause visibility issues.

        Type:
        :   float in [0, inf], default 0.0

    metallic
    :   Amount of mirror reflection for raytrace

        Type:
        :   float in [0, 1], default 0.0

    node_tree
    :   Node tree for node based materials

        Type:
        :   [`NodeTree`](bpy.types.NodeTree.html#bpy.types.NodeTree "bpy.types.NodeTree"), (readonly)

    paint_active_slot
    :   Index of active texture paint slot

        Type:
        :   int in [0, 32767], default 0

    paint_clone_slot
    :   Index of clone texture paint slot

        Type:
        :   int in [0, 32767], default 0

    pass_index
    :   Index number for the “Material Index” render pass

        Type:
        :   int in [0, 32767], default 0

    preview_render_type
    :   Type of preview render

        - `FLAT`
          Flat – Flat XY plane.
        - `SPHERE`
          Sphere – Sphere.
        - `CUBE`
          Cube – Cube.
        - `HAIR`
          Hair – Hair strands.
        - `SHADERBALL`
          Shader Ball – Shader ball.
        - `CLOTH`
          Cloth – Cloth.
        - `FLUID`
          Fluid – Fluid.

        Type:
        :   enum in [`'FLAT'`, `'SPHERE'`, `'CUBE'`, `'HAIR'`, `'SHADERBALL'`, `'CLOTH'`, `'FLUID'`], default `'SPHERE'`

    refraction_depth
    :   Approximate the thickness of the object to compute two refraction events (0 is disabled) (Deprecated)

        Type:
        :   float in [0, inf], default 0.0

    roughness
    :   Roughness of the material

        Type:
        :   float in [0, 1], default 0.4

    show_transparent_back
    :   Render multiple transparent layers (may introduce transparency sorting problems) (Deprecated: use ‘use_tranparency_overlap’)

        Type:
        :   boolean, default True

    specular_color
    :   Specular color of the material

        Type:
        :   [`mathutils.Color`](mathutils.html#mathutils.Color "mathutils.Color") of 3 items in [0, inf], default (1.0, 1.0, 1.0)

    specular_intensity
    :   How intense (bright) the specular reflection is

        Type:
        :   float in [0, 1], default 0.5

    surface_render_method
    :   Controls the blending and the compatibility with certain features

        - `DITHERED`
          Dithered – Allows for grayscale hashed transparency, and compatible with render passes and raytracing. Also known as deferred rendering..
        - `BLENDED`
          Blended – Allows for colored transparency, but incompatible with render passes and raytracing. Also known as forward rendering..

        Type:
        :   enum in [`'DITHERED'`, `'BLENDED'`], default `'DITHERED'`

    texture_paint_images
    :   Texture images used for texture painting

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`Image`](bpy.types.Image.html#bpy.types.Image "bpy.types.Image"), (readonly)

    texture_paint_slots
    :   Texture slots defining the mapping and influence of textures

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`TexPaintSlot`](bpy.types.TexPaintSlot.html#bpy.types.TexPaintSlot "bpy.types.TexPaintSlot"), (readonly)

    thickness_mode
    :   Approximation used to model the light interactions inside the object

        - `SPHERE`
          Sphere – Approximate the object as a sphere whose diameter is equal to the thickness defined by the node tree.
        - `SLAB`
          Slab – Approximate the object as an infinite slab of thickness defined by the node tree.

        Type:
        :   enum in [`'SPHERE'`, `'SLAB'`], default `'SPHERE'`

    use_backface_culling
    :   Use back face culling to hide the back side of faces

        Type:
        :   boolean, default False

    use_backface_culling_lightprobe_volume
    :   Consider material single sided for light probe volume capture. Additionally helps rejecting probes inside the object to avoid light leaks.

        Type:
        :   boolean, default True

    use_backface_culling_shadow
    :   Use back face culling when casting shadows

        Type:
        :   boolean, default False

    use_nodes
    :   Use shader nodes to render the material

        removal planned in version 6.0

        Unused but kept for compatibility reasons. Setting the property has no effect, and getting it always returns True.

        Type:
        :   boolean, default False

    use_preview_world
    :   Use the current world background to light the preview render

        Type:
        :   boolean, default False

    use_raytrace_refraction
    :   Use raytracing to determine transmitted color instead of using only light probes. This prevents the surface from contributing to the lighting of surfaces not using this setting.

        Type:
        :   boolean, default False

    use_screen_refraction
    :   Use raytracing to determine transmitted color instead of using only light probes. This prevents the surface from contributing to the lighting of surfaces not using this setting. Deprecated: use ‘use_raytrace_refraction’.

        Type:
        :   boolean, default False

    use_sss_translucency
    :   Add translucency effect to subsurface (Deprecated)

        Type:
        :   boolean, default False

    use_thickness_from_shadow
    :   Use the shadow maps from shadow casting lights to refine the thickness defined by the material node tree

        Type:
        :   boolean, default False

    use_transparency_overlap
    :   Render multiple transparent layers (may introduce transparency sorting problems)

        Type:
        :   boolean, default True

    use_transparent_shadow
    :   Use transparent shadows for this material if it contains a Transparent BSDF, disabling will render faster but not give accurate shadows

        Type:
        :   boolean, default True

    volume_intersection_method
    :   Determines which inner part of the mesh will produce volumetric effect

        - `FAST`
          Fast – Each face is considered as a medium interface. Gives correct results for manifold geometry that contains no inner parts..
        - `ACCURATE`
          Accurate – Faces are considered as medium interface only when they have different consecutive facing. Gives correct results as long as the max ray depth is not exceeded. Have significant memory overhead compared to the fast method..

        Type:
        :   enum in [`'FAST'`, `'ACCURATE'`], default `'FAST'`

    inline_shader_nodes()
    :   Get the inlined shader nodes of this material. This preprocesses the node tree
        to remove nested groups, repeat zones and more.

        Returns:
        :   The inlined shader nodes.

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

    *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