pygfx.resources.TextureMap

class pygfx.resources.TextureMap(texture: Texture, *, uv_channel=0, filter='linear', mag_filter=None, min_filter=None, mipmap_filter=None, wrap='repeat', wrap_s=None, wrap_t=None)

Bases: Trackable

A texture map.

TextureMap is used to define how a texture should be used in a material. including which uv channel to use, filtering, and wrapping

Parameters:
  • texture (Texture) – The texture to use for this map.

  • uv_channel (int, optional) – The uv channel of the texture to use. e.g. with channel=7, it will use the geometry.texcoords7. Default is 0, which uses the geometry.texcoords.

  • filter (str, optional) – The filter to use for magnification, minification znd mipmap, if not being set separately. Can be “nearest” or “linear”. Default is “linear”.

  • mag_filter (str, optional) – The magnification filter to use. Defaults to the value of filter.

  • min_filter (str, optional) – The minification filter to use. Defaults to the value of filter.

  • mipmap_filter (str, optional) – The mipmap filter to use. Defaults to the value of filter.

  • wrap (str, optional) – The wrap mode for both the s and t coordinates if not being set separately. Can be “clamp”, “repeat”, “mirror”. Default is “repeat”.

  • wrap_s (str, optional) – The wrap mode for the s coordinate. Defaults to the value of wrap.

  • wrap_t (str, optional) – The wrap mode for the t coordinate. Defaults to the value of wrap.

property texture: Texture

The texture to use for this map.

property uv_channel

The channel of the texture to use.

property mag_filter

The magnification filter to use.

property min_filter

The minification filter to use.

property mipmap_filter

The mipmap filter to use.

property wrap_s

The wrap mode for the s coordinate.

property wrap_t

The wrap mode for the t coordinate.

property offset

The uv offset of the texture map.

Note: You should call update_matrix after changing this value to update the matrix.

property scale

The uv scale of the texture map.

Note: You should call update_matrix after changing this value to update the matrix.

property rotation

The rotation of the texture map in uv plane.

Note: You should call update_matrix after changing this value to update the matrix.

update_matrix_components(offset=None, scale=None, rotation=None)

Update the texture map’s matrix with the given offset, scale and rotation.

Parameters:
  • offset (tuple of float, optional) – The offset of the texture map.

  • scale (tuple of float, optional) – The scale of the texture map.

  • rotation (float, optional) – The rotation of the texture map.

update_matrix()

Update the matrix of the texture map.

property uniform_buffer

The uniform buffer of the texture map.

Examples

Ambient occlusion

Ambient occlusion

Clearcoat effect

Clearcoat effect

Colormap Image

Colormap Image

Lightmap

Lightmap

Mesh with quads

Mesh with quads

Subplots Video

Subplots Video

Synced Video Rendering

Synced Video Rendering

Minip Volume Rendering

Minip Volume Rendering

Volume Rendering 1

Volume Rendering 1

Image on Plane Geometry 1

Image on Plane Geometry 1

Validate Colormap

Validate Colormap

Line colormapping

Line colormapping

Mesh Colormaps

Mesh Colormaps

Mesh slice

Mesh slice

Validate OutPass

Validate OutPass

Validate ppaa

Validate ppaa