pygfx.materials.Material

class pygfx.materials.Material(*, opacity=1, clipping_planes=None, clipping_mode='any', depth_test=True, pick_write=False)

Bases: Trackable

Material base class.

Parameters:
  • opacity (float) – The opacity (a.k.a. alpha value) applied to this material, expressed as a value between 0 and 1. If the material contains any non-opaque fragments, their alphas are simply scaled by this value.

  • clipping_planes (tuple) – A tuple of planes (abcd tuples) in world space. Points in space whose signed distance to the plane is negative are clipped (not rendered). Applies to the object to which this material is attached.

  • clipping_mode (str) – Set the behavior for multiple clipping planes: “any” or “all”. If this is “any” (the default) a fragment is discarded if it is clipped by any clipping plane. If this is “all”, a fragment is discarded only if it is clipped by all of the clipping planes.

  • depth_test (bool) – Whether the object takes the depth buffer into account. Default True. If False, the object is like a ghost: not testing against the depth buffer and also not writing to it.

property opacity

The opacity (a.k.a. alpha value) applied to this material, expressed as a value between 0 and 1. If the material contains any non-opaque fragments, their alphas are simply scaled by this value.

property is_transparent

Whether this material is (semi) transparent because of its opacity value. If False the object can still appear transparent because of its color.

property clipping_planes

A tuple of planes (abcd tuples) in world space. Points in space whose signed distance to the plane is negative are clipped (not rendered). Applies to the object to which this material is attached.

property clipping_plane_count

The number of clipping planes (readonly).

property clipping_mode

“ANY” or “ALL”. If this is “ANY” (the default) a fragment is discarded if it is clipped by any clipping plane. If this is “ALL”, a fragment is discarded only if it is clipped by all of the clipping planes.

Type:

Set the behavior for multiple clipping planes

property depth_test

Whether the object takes the depth buffer into account.

property pick_write

Whether this material is picked by the pointer.