pytorch3d.renderer.materials
materials
- class pytorch3d.renderer.materials.Materials(ambient_color=((1, 1, 1),), diffuse_color=((1, 1, 1),), specular_color=((1, 1, 1),), shininess=64, device: str | device = 'cpu')[source]
Bases:
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: str | device = 'cpu') None [source]
- Parameters:
ambient_color – ambient reflectivity of the material
diffuse_color – diffuse reflectivity of the material
specular_color – 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 – Device (as str or torch.device) on which the tensors should be located
ambient_color, diffuse_color and specular_color can be of shape (1, C) or (N, C) where C is typically 3 (for RGB). 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.