pygfx.materials.MeshAbstractMaterial
- class pygfx.materials.MeshAbstractMaterial(color='#fff', color_mode='auto', map=None, maprange=None, side='both', **kwargs)
Bases:
MaterialAbstract 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 (TextureMap | Texture) – The texture map specifying the color at each texture coordinate. Optional.
maprange (tuple) – The range of the
geometry.texcoordsthat is projected onto the (color) map. Default (0, 1).side (str | VisibleSide) – What side of the mesh is visible. Default “both”.
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()ongeometry.indices).- property color
The uniform color of the mesh. This value is ignored if a texture map is used.
- property color_mode
The way that color is applied to the mesh.
- 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 maprange
The range of the
geometry.texcoordsthat is projected onto the (color) map.By default this value is (0.0, 1.0), but if the
texcoordsrepresents some domain-specific value, e.g. temperature, thenmaprangecan be set to e.g. (0, 100).
- property side
Defines which side of faces will be rendered.
See
pygfx.utils.enums.VisibleSide: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()ongeometry.indices).