MetallicRoughnessMaterial

class pyrender.MetallicRoughnessMaterial(name=None, normalTexture=None, occlusionTexture=None, emissiveTexture=None, emissiveFactor=None, alphaMode=None, alphaCutoff=None, doubleSided=False, smooth=True, wireframe=False, baseColorFactor=None, baseColorTexture=None, metallicFactor=1.0, roughnessFactor=1.0, metallicRoughnessTexture=None)[source]

Bases: pyrender.Material

A material based on the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.

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.
  • baseColorFactor ((4,) float, optional) – The RGBA components of the base color of the material. The fourth component (A) is the alpha coverage of the material. The alphaMode property specifies how alpha is interpreted. These values are linear. If a baseColorTexture is specified, this value is multiplied with the texel values.
  • baseColorTexture ((n,n,4) float or Texture, optional) – The base color texture. This texture contains RGB(A) components in sRGB color space. The first three components (RGB) specify the base color of the material. If the fourth component (A) is present, it represents the alpha coverage of the material. Otherwise, an alpha of 1.0 is assumed. The alphaMode property specifies how alpha is interpreted. The stored texels must not be premultiplied.
  • metallicFactor (float) – The metalness of the material. A value of 1.0 means the material is a metal. A value of 0.0 means the material is a dielectric. Values in between are for blending between metals and dielectrics such as dirty metallic surfaces. This value is linear. If a metallicRoughnessTexture is specified, this value is multiplied with the metallic texel values.
  • roughnessFactor (float) – The roughness of the material. A value of 1.0 means the material is completely rough. A value of 0.0 means the material is completely smooth. This value is linear. If a metallicRoughnessTexture is specified, this value is multiplied with the roughness texel values.
  • metallicRoughnessTexture ((n,n,2) float or Texture, optional) – The metallic-roughness texture. The metalness values are sampled from the B channel. The roughness values are sampled from the G channel. These values are linear. If other channels are present (R or A), they are ignored for metallic-roughness calculations.

Attributes Summary

alphaCutoff The cutoff threshold in MASK mode.
alphaMode The mode for blending.
baseColorFactor The RGBA base color multiplier.
baseColorTexture The diffuse texture.
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.
metallicFactor The metalness of the material.
metallicRoughnessTexture The metallic-roughness texture.
name The user-defined name of this object.
normalTexture The tangent-space normal map.
occlusionTexture The ambient occlusion map.
roughnessFactor The roughness of the material.
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
baseColorFactor

The RGBA base color multiplier.

Type:(4,) float or Texture
baseColorTexture

The diffuse texture.

Type:(n,n,4) float or Texture
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
metallicFactor

The metalness of the material.

Type:float
metallicRoughnessTexture

The metallic-roughness texture.

Type:(n,n,2) float or Texture
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
roughnessFactor

The roughness of the material.

Type:float
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