pyblenderSDIC.materials.MaterialBSDF#
- class MaterialBSDF(base_color: Sequence[Number] | ndarray | None = None, metallic: Number | None = None, roughness: Number | None = None, IOR: Number | None = None, alpha: Number | None = None, normal: Sequence[Number] | ndarray | None = None, weight: Number | None = None, subsurface_weight: Number | None = None, subsurface_radius: Sequence[Number] | ndarray | None = None, subsurface_scale: Number | None = None, subsurface_IOR: Number | None = None, subsurface_anisotropy: Number | None = None, specular_IOR_level: Number | None = None, specular_tint: Sequence[Number] | ndarray | None = None, anisotropic: Number | None = None, anisotropic_rotation: Number | None = None, tangent: Sequence[Number] | ndarray | None = None, transmission_weight: Number | None = None, coat_weight: Number | None = None, coat_roughness: Number | None = None, coat_IOR: Number | None = None, coat_tint: Sequence[Number] | ndarray | None = None, coat_normal: Sequence[Number] | ndarray | None = None, sheen_weight: Number | None = None, sheen_roughness: Number | None = None, sheen_tint: Sequence[Number] | ndarray | None = None, emission_color: Sequence[Number] | ndarray | None = None, emission_strength: Number | None = None, thin_film_thickness: Number | None = None, thin_film_IOR: Number | None = None)[source]#
Bases:
object
Represents a material with detailed physical and visual properties for Blender’s BSDF Principled shader. The class used the Blender’s Principled BSDF shader as a base for the material. The parameters are based on the Blender’s documentation.
Note
If a pattern will be used for the associated mesh, the base color can be ignored. The pattern will be used as the base color of the material. If the pattern and a base color are both set, the pattern will be multiplied by the given base color.
- Parameters:
base_color (array_like, optional) – The base color of the material, with RGBA values. Default to None.
metallic (float, optional) – The metallic value of the material. Default to None.
roughness (float, optional) – The roughness value of the material. Default to None.
IOR (float, optional) – The index of refraction of the material. Default to None.
alpha (float, optional) – The alpha value of the material. Default to None.
normal (array_like, optional) – The normal of the material with XYZ values. Default to None.
weight (float, optional) – The weight of the material. Default to None.
subsurface_weight (float, optional) – The subsurface weight of the material. Default to None.
subsurface_radius (array_like, optional) – The subsurface radius of the material. Default to None.
subsurface_scale (float, optional) – The subsurface scale of the material. Default to None.
subsurface_IOR (float, optional) – The subsurface index of refraction of the material. Default to None.
subsurface_anisotropy (float, optional) – The subsurface anisotropy of the material. Default to None.
specular_IOR_level (float, optional) – The specular index of refraction level of the material. Default to None.
specular_tint (array_like, optional) – The specular tint of the material with RGBA values. Default to None.
anisotropic (float, optional) – The anisotropic value of the material. Default to None.
anisotropic_rotation (float, optional) – The anisotropic rotation of the material. Default to None.
tangent (array_like, optional) – The tangent of the material with XYZ values. Default to None.
transmission_weight (float, optional) – The transmission weight of the material. Default to None.
coat_weight (float, optional) – The coat weight of the material. Default to None.
coat_roughness (float, optional) – The coat roughness of the material. Default to None.
coat_IOR (float, optional) – The coat index of refraction of the material. Default to None.
coat_tint (array_like, optional) – The coat tint of the material with RGBA values. Default to None.
coat_normal (array_like, optional) – The coat normal of the material with XYZ values. Default to None.
sheen_weight (float, optional) – The sheen weight of the material. Default to None.
sheen_roughness (float, optional) – The sheen roughness of the material. Default to None.
sheen_tint (array_like, optional) – The sheen tint of the material with RGBA values. Default to None.
emission_color (array_like, optional) – The emission color of the material with RGBA values. Default to None.
emission_strength (float, optional) – The emission strength of the material. Default to None.
thin_film_thickness (float, optional) – The thin film thickness of the material. Default to None.
thin_film_IOR (float, optional) – The thin film index of refraction of the material. Default to None.
- property IOR: Number | None#
- property alpha: Number | None#
- property anisotropic: Number | None#
- property anisotropic_rotation: Number | None#
- property base_color: ndarray | None#
- property coat_IOR: Number | None#
- property coat_normal: ndarray | None#
- property coat_roughness: Number | None#
- property coat_tint: ndarray | None#
- property coat_weight: Number | None#
- property emission_color: ndarray | None#
- property emission_strength: Number | None#
- classmethod from_dict(data: Dict) MaterialBSDF [source]#
Create a MaterialBSDF instance from a dictionary.
The structure of the dictionary should be as provided by the
pyblenderSDIC.meshes.MaterialBSDF.to_dict()
method. The other fields of the dictionary are ignored.from pyblenderSDIC.materials import MaterialBSDF mat_dict = { "type": "MaterialBSDF [pyblenderSDIC]", "description": "Description of the material", "base_color": [0.5, 0.5, 0.5, 1.0], "metallic": 0.5, "roughness": 0.5, } # Create a MaterialBSDF instance from the dictionary material = MaterialBSDF.from_dict(mat_dict)
See also
pyblenderSDIC.meshes.MaterialBSDF.to_dict()
for saving the mesh to a dictionary.pyblenderSDIC.meshes.MaterialBSDF.from_json()
for loading from a JSON file.
- Parameters:
data (dict) – A dictionary containing the material’s data.
- Returns:
The MaterialBSDF instance.
- Return type:
- Raises:
ValueError – If the data is not a dictionary.
KeyError – If required keys are missing from the dictionary.
- classmethod from_json(filepath: str) MaterialBSDF [source]#
Create a MaterialBSDF instance from a JSON file.
The structure of the JSON file follows the
pyblenderSDIC.materials.MaterialBSDF.to_dict()
method.from pyblenderSDIC.materials import MaterialBSDF # Load the mesh from a JSON file material = MaterialBSDF.from_json("path/to/mesh.json")
See also
pyblenderSDIC.materials.MaterialBSDF.to_json()
for saving the material to a JSON file.pyblenderSDIC.materials.MaterialBSDF.from_dict()
for loading from a dictionary.
- Parameters:
filepath (str) – The path to the JSON file.
- Returns:
A MaterialBSDF instance.
- Return type:
- Raises:
FileNotFoundError – If the filepath is not a valid path.
- classmethod get_details() str [source]#
Get detailed descriptions of each parameter in the MaterialBSDF class.
- Returns:
str: A detailed description of all parameters and their roles in Blender materials.
- property metallic: Number | None#
- property normal: ndarray | None#
- property roughness: Number | None#
- property sheen_roughness: Number | None#
- property sheen_tint: ndarray | None#
- property sheen_weight: Number | None#
- property specular_IOR_level: Number | None#
- property specular_tint: ndarray | None#
- property subsurface_IOR: Number | None#
- property subsurface_anisotropy: Number | None#
- property subsurface_radius: ndarray | None#
- property subsurface_scale: Number | None#
- property subsurface_weight: Number | None#
- property tangent: ndarray | None#
- property thin_film_IOR: Number | None#
- property thin_film_thickness: Number | None#
- to_dict(description: str = '') Dict [source]#
Export the MaterialBSDF’s data to a dictionary.
The structure of the dictionary is as follows:
{ "type": "MaterialBSDF [pyblenderSDIC]", "description": "Description of the material", "base_color": [0.5, 0.5, 0.5, 1.0], "metallic": 0.5, "roughness": 0.5, "IOR": 1.5, "...": ..., }
- Parameters:
description (str, optional) – A description of the material, by default “”.
- Returns:
A dictionary containing the MaterialBSDF’s data.
- Return type:
dict
- Raises:
ValueError – If the description is not a string.
- to_json(filepath: str, description: str = '') None [source]#
Export the MaterialBSDF’s data to a JSON file.
The structure of the JSON file follows the
pyblenderSDIC.materials.MaterialBSDF.to_dict()
method.- Parameters:
filepath (str) – The path to the JSON file.
description (str, optional) – A description of the material, by default “”.
- Raises:
FileNotFoundError – If the filepath is not a valid path.
- property transmission_weight: Number | None#
- property weight: Number | None#