materials

class pytorch3d.renderer.materials.Materials(ambient_color=((1, 1, 1), ), diffuse_color=((1, 1, 1), ), specular_color=((1, 1, 1), ), shininess=64, device='cpu')[source]

Bases: pytorch3d.renderer.utils.TensorProperties

A class for storing a batch of material properties. Currently only one material per batch element is supported.

__init__(ambient_color=((1, 1, 1), ), diffuse_color=((1, 1, 1), ), specular_color=((1, 1, 1), ), shininess=64, device='cpu')[source]
Parameters:
  • ambient_color – RGB ambient reflectivity of the material
  • diffuse_color – RGB diffuse reflectivity of the material
  • specular_color – RGB specular reflectivity of the material
  • shininess – The specular exponent for the material. This defines the focus of the specular highlight with a high value resulting in a concentrated highlight. Shininess values can range from 0-1000.
  • device – torch.device or string

ambient_color, diffuse_color and specular_color can be of shape (1, 3) or (N, 3). shininess can be of shape (1) or (N).

The colors and shininess are broadcast against each other so need to have either the same batch dimension or batch dimension = 1.

clone()[source]