Material

class pyrender.Material(name=None, normalTexture=None, occlusionTexture=None, emissiveTexture=None, emissiveFactor=None, alphaMode=None, alphaCutoff=None, doubleSided=False, smooth=True, wireframe=False)[source]

Bases: object

Base for standard glTF 2.0 materials.

Parameters:
  • name (str, optional) – The user-defined name of this object.
  • normalTexture ((n,n,3) float or Texture, optional) – A tangent space normal map. The texture contains RGB components in linear space. Each texel represents the XYZ components of a normal vector in tangent space. Red [0 to 255] maps to X [-1 to 1]. Green [0 to 255] maps to Y [-1 to 1]. Blue [128 to 255] maps to Z [1/255 to 1]. The normal vectors use OpenGL conventions where +X is right and +Y is up. +Z points toward the viewer.
  • occlusionTexture ((n,n,1) float or Texture, optional) – The occlusion map texture. The occlusion values are sampled from the R channel. Higher values indicate areas that should receive full indirect lighting and lower values indicate no indirect lighting. These values are linear. If other channels are present (GBA), they are ignored for occlusion calculations.
  • emissiveTexture ((n,n,3) float or Texture, optional) – The emissive map controls the color and intensity of the light being emitted by the material. This texture contains RGB components in sRGB color space. If a fourth component (A) is present, it is ignored.
  • emissiveFactor ((3,) float, optional) – The RGB components of the emissive color of the material. These values are linear. If an emissiveTexture is specified, this value is multiplied with the texel values.
  • alphaMode (str, optional) –

    The material’s alpha rendering mode enumeration specifying the interpretation of the alpha value of the main factor and texture. Allowed Values:

    • ”OPAQUE” The alpha value is ignored and the rendered output is fully opaque.
    • ”MASK” The rendered output is either fully opaque or fully transparent depending on the alpha value and the specified alpha cutoff value.
    • ”BLEND” The alpha value is used to composite the source and destination areas. The rendered output is combined with the background using the normal painting operation (i.e. the Porter and Duff over operator).
  • alphaCutoff (float, optional) – Specifies the cutoff threshold when in MASK mode. If the alpha value is greater than or equal to this value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. A value greater than 1.0 will render the entire material as fully transparent. This value is ignored for other modes.
  • doubleSided (bool, optional) – Specifies whether the material is double sided. When this value is false, back-face culling is enabled. When this value is true, back-face culling is disabled and double sided lighting is enabled.
  • smooth (bool, optional) – If True, the material is rendered smoothly by using only one normal per vertex and face indexing.
  • wireframe (bool, optional) – If True, the material is rendered in wireframe mode.

Attributes Summary

alphaCutoff The cutoff threshold in MASK mode.
alphaMode The mode for blending.
doubleSided Whether the material is double-sided.
emissiveFactor Base multiplier for emission colors.
emissiveTexture The emission map.
is_transparent If True, the object is partially transparent.
name The user-defined name of this object.
normalTexture The tangent-space normal map.
occlusionTexture The ambient occlusion map.
smooth Whether to render the mesh smoothly by interpolating vertex normals.
tex_flags Texture availability flags.
textures The textures associated with this material.
wireframe Whether to render the mesh in wireframe mode.

Attributes Documentation

alphaCutoff

The cutoff threshold in MASK mode.

Type:float
alphaMode

The mode for blending.

Type:str
doubleSided

Whether the material is double-sided.

Type:bool
emissiveFactor

Base multiplier for emission colors.

Type:(3,) float
emissiveTexture

The emission map.

Type:(n,n,3) float or Texture
is_transparent

If True, the object is partially transparent.

Type:bool
name

The user-defined name of this object.

Type:str
normalTexture

The tangent-space normal map.

Type:(n,n,3) float or Texture
occlusionTexture

The ambient occlusion map.

Type:(n,n,1) float or Texture
smooth

Whether to render the mesh smoothly by interpolating vertex normals.

Type:bool
tex_flags

Texture availability flags.

Type:int
textures

The textures associated with this material.

Type:list of Texture
wireframe

Whether to render the mesh in wireframe mode.

Type:bool