pygfx.materials.PointsMaterial
- class pygfx.materials.PointsMaterial(size=4, size_space='screen', size_mode='uniform', *, color=(1, 1, 1, 1), color_mode='auto', map=None, map_interpolation='linear', aa=True, **kwargs)
Bases:
Material
Point default material.
Renders disks of the given size and color.
- Parameters:
size (float) – The size (diameter) of the points in logical pixels. Default 4.
size_space (str | CoordSpace) – The coordinate space in which the size is expressed (‘screen’, ‘world’, ‘model’). Default ‘screen’.
size_mode (str | SizeMode) – The mode by which the points are sized. Default ‘uniform’.
color (str | tuple | Color) – The uniform color of the points (used depending on the
color_mode
).color_mode (str | ColorMode) – The mode by which the points are coloured. Default ‘auto’.
map (Texture) – The texture map specifying the color for each texture coordinate.
map_interpolation (str) – The method to interpolate the color map. Either ‘nearest’ or ‘linear’. Default ‘linear’.
aa (bool) – Whether or not the points are anti-aliased in the shader. Default True.
kwargs (Any) – Additional kwargs will be passed to the
material base class
.
- property color
The color of the points (if map is not set).
- property color_is_transparent
Whether the color is (semi) transparent (i.e. not fully opaque).
- property aa
Whether the point’s visual edge is anti-aliased.
Aliasing gives prettier results by producing semi-transparent fragments at the edges. Points smaller than one physical pixel are also diminished by making them more transparent.
Note that by default, pygfx uses SSAA to anti-alias the total renderered result. Point-based aa results in additional improvement.
Because semi-transparent fragments are introduced, it may affect how the points blends with other (semi-transparent) objects. It can also affect performance for very large datasets. In particular, when the points itself are opaque, the point is (in most blend modes) drawn twice to account for both the opaque and semi-transparent fragments.
- property color_mode
The way that color is applied to the mesh.
- property size
The size (diameter) of the points, in logical pixels (or world/model space if
size_space
is set).
- property size_space
The coordinate space in which the size is expressed.
- property size_mode
The way that size 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.
- property map_interpolation
The method to interpolate the colormap. Either ‘nearest’ or ‘linear’.