Class Material
- Namespace
Methods
addUniformProperty
Add a shader uniform parameter to the given custom pattern
material.addUniformProperty(pattern, name, type)
Parameters
patternCustomMaterialPatternThe custom pattern to edit
nameStringName of the new property
typeShaderUniformTypeType of the new uniform
clearAllMaterials
Remove and delete all the materials
material.clearAllMaterials()
configureFunctionLogger
material.configureFunctionLogger(functionName, enableFunction, enableParameters, enableExecutionTime)
Parameters
convertFloat32To8BitsImage
Returns a new image from the given converter from 32bits float to a 8Bits (e.g. depth render map)
material.convertFloat32To8BitsImage(image32F, minValue, maxValue) -> material.Image
Parameters
image32FImageImage to convert
minValueDoubleMinimal value of the floats (will be 0 in 8bits)
maxValueDoubleMinimal value of the floats (will be 255 in 8bits)
Returns
- Image
The new 8bits image
convertHeightMapToNormalMap
Convert a height map to a normal map
material.convertHeightMapToNormalMap(hmap, height) -> material.Image
Parameters
Returns
- Image
Normal map
copyMaterial
copies a material
material.copyMaterial(toCopy, addToMaterialLibrary) -> material.Material
Parameters
Returns
- Material
The copied material
createCustomMaterialPattern
Create a new custom material pattern
material.createCustomMaterialPattern(name) -> material.CustomMaterialPattern
Parameters
nameStringName of the pattern
Returns
- CustomMaterialPattern
The created material pattern
createImageFromDefinition
Import an image from its raw data
material.createImageFromDefinition(imageDefinition) -> material.Image
Parameters
imageDefinitionImageDefinitionThe image definition
Returns
- Image
The created image
createImagesFromDefinitions
Import images from their raw data
material.createImagesFromDefinitions(imageDefinitions) -> material.ImageList
Parameters
imageDefinitionsImageDefinitionListThe image definitions
Returns
- ImageList
The created images
createMaterial
Create a new material from pattern
material.createMaterial(name, pattern, addToMaterialLibrary) -> material.Material
Parameters
nameStringName of the material
patternStringName of the pattern
addToMaterialLibraryBooleanName of the pattern
Returns
- Material
The created material
createMaterialFromDefinition
Create PBR material from a material definition
material.createMaterialFromDefinition(materialDefinition) -> material.Material
Parameters
materialDefinitionMaterialDefinitionThe structure containing all the PBR material information
Returns
- Material
The created material
createMaterialsFromDefinitions
Create PBR materials from material definitions
material.createMaterialsFromDefinitions(materialDefinitions) -> material.MaterialList
Parameters
materialDefinitionsMaterialDefinitionListMaterial definitions containing properties for each given material
Returns
- MaterialList
The created materials
createMaterialsFromMaps
Automatically creates PBR materials when importing PBR texture maps from a folder
material.createMaterialsFromMaps(directory)
Parameters
directoryDirectoryPathDirectory path
exportImage
Export an image
material.exportImage(image, filename)
Parameters
imageImageIdentifier of the image to export
filenameOutputFilePathFilename of the file to export
fillUnusedPixels
Fill unused pixels by propagating and averaging used pixels
material.fillUnusedPixels(image, unusedColor) -> material.Image
Parameters
imageImageImage to process
unusedColorColorAlphaColor used to identify unused pixels
Returns
- Image
Resulting image with filled pixels
filterAO
Filter an AO map using ATrous method
material.filterAO(aoMap, normalMap, sigmaPos, sigmaValue, sigmaNormal, levelCount, filterLowValues, lowValueThreshold) -> material.Image
Parameters
aoMapImageInput AO Map (the alpha component must be set to 0 for unused pixels)
normalMapImageInput Normal Map (preferable to use a World space normal map, but an Object space normal map can be used)
sigmaPosDoubleATrous Sigma pos
sigmaValueDoubleATrous Sigma value
sigmaNormalDoubleATrous Sigma normal
levelCountIntAtrous #Levels
filterLowValuesBooleanRemove low values from the filtering (see: lowValuesThreshold parameter)
lowValueThresholdDoubleThreshold used if filterLowValues is enabled
Returns
- Image
The filtered AO Map
findCustomMaterialPatternByName
Returns the material pattern which has the given name
material.findCustomMaterialPatternByName(name) -> material.CustomMaterialPattern
Parameters
nameStringThe name of the material pattern
Returns
- CustomMaterialPattern
The material pattern
findMaterialsByPattern
Returns all materials using the given pattern
material.findMaterialsByPattern(pattern) -> material.MaterialList
Parameters
patternStringA material pattern
Returns
- MaterialList
Materials using the pattern
findMaterialsByProperty
Returns all materials which match a given property value
material.findMaterialsByProperty(propertyName, propertyValue) -> material.MaterialList
Parameters
propertyNameStringName of the property to match
propertyValueRegexRegular expression to match for the property value
Returns
- MaterialList
Materials matching the property value
getAllImages
Returns all the images loaded in the current session or from a list of materials
material.getAllImages(materials) -> material.ImageList
Parameters
materialsMaterialListMaterials to retrieve the images from (returns all images loaded in the current session if empty)
Returns
- ImageList
A list containing all images identifiers
getAllMaterialPatterns
Returns all the material patterns in the current session
material.getAllMaterialPatterns() -> core.StringList
Returns
- StringList
A list containing all material patterns
getAllMaterials
Retrieve the list of all the materials in the material library
material.getAllMaterials() -> material.MaterialList
Returns
- MaterialList
List of materials in the material library
getColorMaterialInfos
Get color material properties
material.getColorMaterialInfos(material) -> material.ColorMaterialInfos
Parameters
materialMaterialThe material to get properties
Returns
- ColorMaterialInfos
The ColorMaterialInfos properties
getCustomMaterialPattern
Returns the custom material pattern associated to the custom material
material.getCustomMaterialPattern(material) -> material.CustomMaterialPattern
Parameters
materialMaterialCustom material to get the pattern from
Returns
- CustomMaterialPattern
The custom material pattern
getImageDefinition
Returns the raw data of an image
material.getImageDefinition(image) -> material.ImageDefinition
Parameters
imageImageImage's definition
Returns
- ImageDefinition
Definition of the image
getImageDefinitions
Returns the raw data of a set of images
material.getImageDefinitions(images) -> material.ImageDefinitionList
Parameters
imagesImageListThe images
Returns
- ImageDefinitionList
Images's definitions
getImageSize
Returns the size of an image
material.getImageSize(image) -> core.Int, core.Int
Parameters
imageImageThe image to get the size from
Returns
- Int
The width of the image in pixels
getImportImageFormats
Give all the image format name and their extensions that can be imported in Pixyz
material.getImportImageFormats() -> core.FormatList
Returns
- FormatList
Image formats that can be imported in Pixyz
getImpostorMaterialInfos
Get impostor texture material properties
material.getImpostorMaterialInfos(material) -> material.ImpostorMaterialInfos
Parameters
materialMaterialThe material to get properties
Returns
- ImpostorMaterialInfos
The getImpostorMaterialInfos properties
getMaterialDefinition
Returns the properties of a PBR Material
material.getMaterialDefinition(material) -> material.MaterialDefinition
Parameters
materialMaterialThe PBR Material
Returns
- MaterialDefinition
The PBR material definition
getMaterialDefinitions
Returns the properties of a set of PBR Materials
material.getMaterialDefinitions(materials) -> material.MaterialDefinitionList
Parameters
materialsMaterialListThe PBR Materials
Returns
- MaterialDefinitionList
The PBR Material definitions
getMaterialMainColor
Get the main color on any material pattern type
material.getMaterialMainColor(material) -> core.ColorAlpha
Parameters
materialMaterialThe material
Returns
- ColorAlpha
The main color
getMaterialPattern
Gets the MaterialPattern name of the material
material.getMaterialPattern(material) -> core.String
Parameters
materialMaterialThe material to find the pattern
Returns
- String
The pattern of the material
getMaterialPatternType
Returns the MaterialPatternType name of the material
material.getMaterialPatternType(material) -> material.MaterialPatternType
Parameters
materialMaterialThe material to find the pattern
Returns
- MaterialPatternType
The pattern type of the material
getPBRMaterialInfos
Get PBR material properties
material.getPBRMaterialInfos(material) -> material.PBRMaterialInfos
Parameters
materialMaterialThe material to get properties
Returns
- PBRMaterialInfos
The PBRMaterialInfos properties
getStandardMaterialInfos
Get standard material properties
material.getStandardMaterialInfos(material) -> material.StandardMaterialInfos
Parameters
materialMaterialThe material to get properties
Returns
- StandardMaterialInfos
The StandardMaterialInfos properties
getUniformPropertyType
Get a shader uniform shader property type
material.getUniformPropertyType(pattern, name) -> material.ShaderUniformType
Parameters
patternCustomMaterialPatternThe custom pattern
nameStringName of the property to get the type from
Returns
- ShaderUniformType
Type of the uniform property
getUnlitTextureMaterialInfos
Get unlit texture material properties
material.getUnlitTextureMaterialInfos(material) -> material.UnlitTextureMaterialInfos
Parameters
materialMaterialThe material to get properties
Returns
- UnlitTextureMaterialInfos
The UnlitTextureMaterialInfos properties
importImage
Import an image
material.importImage(filename) -> material.Image
Parameters
filenameFilePathFilename of the image to import
Returns
- Image
Identifier of the imported image
isOpaque
Check if material is opaque
material.isOpaque(material) -> core.Boolean
Parameters
materialMaterialMaterial to check opacity
Returns
- Boolean
Returns True if opaque or False if transparent
makeMaterialNamesUnique
Rename materials to have a unique name for each one
material.makeMaterialNamesUnique(materials=[])
Parameters
materialsMaterialListMaterials to rename (rename all materials if empty)
remapIndexMap
create remapped versions of index maps
material.remapIndexMap(maps, maxIndices) -> material.ImageList, core.IntListList
Parameters
Returns
- ImageList
Output maps remapped
resizeImage
Resize an image
material.resizeImage(image, width, height)
Parameters
setFragmentShader
Set the fragment shader of a custom pattern
material.setFragmentShader(pattern, code)
Parameters
patternCustomMaterialPatternThe custom pattern to edit
codeStringThe GLSL code of the fragment shader
setMaterialMainColor
Set the main color on any material pattern type
material.setMaterialMainColor(material, color)
Parameters
materialMaterialThe material to apply the color on
colorColorAlphaThe color to apply
setMaterialPattern
Sets the MaterialPattern name of the material
material.setMaterialPattern(material, pattern)
Parameters
setPBRMaterialInfos
Set PBR material properties
material.setPBRMaterialInfos(material, infos)
Parameters
materialMaterialThe material to set properties
infosPBRMaterialInfosThe PBRMaterialInfos properties
setVertexShader
Set the vertex shader of a custom pattern
material.setVertexShader(pattern, code)
Parameters
patternCustomMaterialPatternThe custom pattern to edit
codeStringThe GLSL code of the vertex shader
updateImageFromDefinition
Update an image from its raw data
material.updateImageFromDefinition(image, imageDefinition)
Parameters
imageImageThe image to update
imageDefinitionImageDefinitionThe new data to apply
updateImagesFromDefinitions
Update images from their raw data
material.updateImagesFromDefinitions(image, imageDefinitions)
Parameters
imageImageListThe image to update
imageDefinitionsImageDefinitionListThe new data to apply
getMaterialUserData
Set or replace a userdata stored on an material
material.getMaterialUserData(userDataId, material) -> core.Ptr
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialMaterialMaterial that store the user data
Returns
- Ptr
User data stored in the given material
getMultipleMaterialUserData
Batch version of getMaterialUserData
material.getMultipleMaterialUserData(userDataId, materials) -> core.PtrList
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialsMaterialListMaterials that store the user data
Returns
- PtrList
User data stored for each given material
hasMaterialUserData
Set or replace a userdata stored on an material
material.hasMaterialUserData(userDataId, material) -> core.Bool
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialMaterialMaterial that potentially store the user data
Returns
- Bool
Returns true if a userdata is stored on this material for the given userDataId
hasMultipleMaterialUserData
Batch version of hasMaterialUserData
material.hasMultipleMaterialUserData(userDataId, materials) -> core.BoolList
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialsMaterialListMaterials that potentially store the user data
Returns
- BoolList
Returns an array of bool that are true if a userdata is stored on the material at the same index for the given userDataId
setMaterialUserData
Set or replace a userdata stored on an material
material.setMaterialUserData(userDataId, material, userData)
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialMaterialMaterial that will store the user data
userDataPtrUser data to store in the given material
setMultipleMaterialUserData
Batch version of setMaterialUserData
material.setMultipleMaterialUserData(userDataId, materials, userDataList)
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialsMaterialListMaterials that will store the user data
userDataListPtrListUser data to store on each material
subscribeToMaterialUserData
subscribe to material user data. multiple different userdata can be stored on the same materials if subscribeToMaterialUserData is called multiple times
material.subscribeToMaterialUserData() -> material.MaterialUserData
Returns
- MaterialUserData
UserData identifier to pass to setUserData/getUserData functions
unsetMaterialUserData
Unset the userdata stored on an material
material.unsetMaterialUserData(userDataId, material)
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialMaterialMaterial that will store the user data
unsetMultipleMaterialUserData
Batch version of unsetMaterialUserData
material.unsetMultipleMaterialUserData(userDataId, materials)
Parameters
userDataIdMaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materialsMaterialListMaterials that will store the user data
unsubscribeFromMaterialUserData
material.unsubscribeFromMaterialUserData(userDataId)
Parameters
userDataIdMaterialUserDataUserData identifier to unsubscribe
ImageChanged
def onImageChanged(type, image):
pass
id = material.addImageChangedCallback(onImageChanged)
...
material.removeImageChangedCallback(id)
Parameters
typeImageChangeTypeType of image change
imageImageImage changed
MaterialChanged
def onMaterialChanged(type, material):
pass
id = material.addMaterialChangedCallback(onMaterialChanged)
...
material.removeMaterialChangedCallback(id)
Parameters
typeMaterialChangeTypeType of material change
materialMaterialMaterial changed