pygfx.materials.MeshAbstractMaterial

class pygfx.materials.MeshAbstractMaterial(color='#fff', color_mode='auto', map=None, map_interpolation='linear', side='BOTH', **kwargs)

Bases: Material

Abstract mesh material.

The abstract parent class for all mesh materials, defining their common properties.

Parameters:
  • color (Color) – The uniform color of the mesh (used depending on the color_mode).

  • color_mode (str | ColorMode) – The mode by which the mesh is coloured. Default ‘auto’.

  • map (Texture) – The texture map specifying the color at each texture coordinate. Optional.

  • map_interpolation (str) – The method to interpolate the color map. Either ‘nearest’ or ‘linear’. Default ‘linear’.

  • side (str) – The culling mode for this material: "FRONT", "BACK", or "BOTH". “FRONT” will only render faces that face the camera. “BACK” will only render faces that face away from the camera. “BOTH” will render faces regardless of their orientation.

  • kwargs (Any) – Additional kwargs will be passed to the material base class.

Notes

The color format of the map is assumed to be sRGB. To use physical space instead, set the texture’s colorspace property to “physical”. To learn more about this, check out the colorspace documentation

The direction of a face is determined using Counter-clockwise (CCW) winding; i.e., if the fingers of your curled hand match the direction in which the face’s vertices are defined then your thumb points into the “FRONT” direction of the face. If this is not the case for your mesh, adjust its geometry (using e.g. np.fliplr() on geometry.indices).

property color

The uniform color of the mesh. This value is ignored if a texture map is used.

property color_is_transparent

Whether the color is (semi) transparent (i.e. not fully opaque).

property color_mode

The way that color is applied to the mesh.

See pygfx.utils.enums.ColorMode:

property map

The texture map specifying the color for each texture coordinate. The dimensionality of the map can be 1D, 2D or 3D, but should match the number of columns in the geometry’s texcoords.

The colors in the map are assumed to be in sRGB space. To use physical space instead, set the texture’s colorspace property to “physical”.

property map_interpolation

The method to interpolate the colormap. Either ‘nearest’ or ‘linear’.

property side

“FRONT”, “BACK”, or “BOTH”. By default this is “BOTH”. Setting to “FRONT” or “BACK” will only render faces from that side, hiding the other. A feature also known as culling.

Which side of the mesh is the front is determined by the winding of the faces. Counter-clockwise (CCW) winding is assumed. If this is not the case, adjust your geometry (using e.g. np.fliplr() on geometry.indices).

Type:

Defines which side of faces will be rendered