pygfx.materials.Material

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

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.

Examples

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_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