Material class

Material class

Material defines the parameters necessary for visual appearance of geometry. Aspose.3D provides shading model for LambertMaterial, PhongMaterial and ShaderMaterial

Inheritance: MaterialA3DObject

The Material type exposes the following members:

Properties

PropertyDescription
nameGets or sets the name.
propertiesGets the collection of all properties.
MAP_SPECULARUsed in Material.set_texture to assign a specular texture mapping.
MAP_DIFFUSEUsed in Material.set_texture to assign a diffuse texture mapping.
MAP_EMISSIVEUsed in Material.set_texture to assign a emissive texture mapping.
MAP_AMBIENTUsed in Material.set_texture to assign a ambient texture mapping.
MAP_NORMALUsed in Material.set_texture to assign a normal texture mapping.

Methods

MethodDescription
remove_property(self, property)Removes a dynamic property.
remove_property(self, property)Remove the specified property identified by name
get_property(self, property)Get the value of specified property
set_property(self, property, value)Sets the value of specified property
find_property(self, property_name)Finds the property.
It can be a dynamic property (Created by CreateDynamicProperty/SetProperty)
or native property(Identified by its name)
get_texture(self, slot_name)Gets the texture from the specified slot, it can be material’s property name or shader’s parameter name
set_texture(self, slot_name, texture)Sets the texture to specified slot

Example

from aspose.threed.shading import LambertMaterial, Material, Texture

mat = LambertMaterial()
tex = Texture()
tex.file_name = "diffuse.png"
mat.set_texture(Material.MAP_DIFFUSE, tex)
for slot in mat:
    print(f"Texture slot {slot.slot_name} = {slot.texture}")

See Also