pysdic_blender.BlenderMaterialBSDF#

class BlenderMaterialBSDF(base_color=None, metallic=None, roughness=None, IOR=None, alpha=None, normal=None, weight=None, subsurface_weight=None, subsurface_radius=None, subsurface_scale=None, subsurface_IOR=None, subsurface_anisotropy=None, specular_IOR_level=None, specular_tint=None, anisotropic=None, anisotropic_rotation=None, tangent=None, transmission_weight=None, coat_weight=None, coat_roughness=None, coat_IOR=None, coat_tint=None, coat_normal=None, sheen_weight=None, sheen_roughness=None, sheen_tint=None, emission_color=None, emission_strength=None, thin_film_thickness=None, thin_film_IOR=None)[source]#

Bases: object

The parameters of the Principled BSDF shader of Blender for the material of a mesh.

Each field is an input of the shader (see the Blender manual); a field left to None keeps the default value of Blender. The colors are RGBA tuples, the vectors (normals, tangent, radius) XYZ tuples.

With a texture (see BlenderMesh), the reflectance of the texture is multiplied by base_color (white by default).

The object is immutable: use dataclasses.replace() to change a field, e.g. dataclasses.replace(get_steel_material(), roughness=0.4).

Raises:

ValueError – If a field has a wrong number of values or non-finite values.

Parameters:
classmethod from_dict(data)[source]#

Create a material from a dictionary of to_dict() ("type" and "description" are ignored, an unknown key raises a KeyError).

Parameters:

data (Dict[str, Any])

Return type:

BlenderMaterialBSDF

classmethod from_json(path)[source]#

Create a material from a JSON file (see from_dict()).

Parameters:

path (str)

Return type:

BlenderMaterialBSDF

principled_inputs()[source]#

The values given to the inputs of the Principled BSDF node: {input name: value} for the fields that are not None.

Return type:

Dict[str, Any]

to_dict(description=None)[source]#

Export the material to a dictionary: {"type": "BlenderMaterialBSDF", "description": ..., <field>: <value>} with the fields that are not None (lists for the tuples).

Parameters:

description (str | None)

Return type:

Dict[str, Any]

to_json(path, description=None)[source]#

Export the material to a JSON file (see to_dict()).

Parameters:
  • path (str)

  • description (str | None)

Return type:

None