Class Material
- Namespace
Methods
addUniformProperty
Add a shader uniform parameter to the given custom pattern
material.addUniformProperty(pattern, name, type)
Parameters
pattern
CustomMaterialPatternThe custom pattern to edit
name
StringName of the new property
type
ShaderUniformTypeType 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
image32F
ImageImage to convert
minValue
DoubleMinimal value of the floats (will be 0 in 8bits)
maxValue
DoubleMinimal 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
name
StringName of the pattern
Returns
- CustomMaterialPattern
The created material pattern
createImageFromDefinition
Import an image from its raw data
material.createImageFromDefinition(imageDefinition) -> material.Image
Parameters
imageDefinition
ImageDefinitionThe image definition
Returns
- Image
The created image
createImagesFromDefinitions
Import images from their raw data
material.createImagesFromDefinitions(imageDefinitions) -> material.ImageList
Parameters
imageDefinitions
ImageDefinitionListThe image definitions
Returns
- ImageList
The created images
createMaterial
Create a new material from pattern
material.createMaterial(name, pattern, addToMaterialLibrary) -> material.Material
Parameters
name
StringName of the material
pattern
StringName of the pattern
addToMaterialLibrary
BooleanName of the pattern
Returns
- Material
The created material
createMaterialFromDefinition
Create PBR material from a material definition
material.createMaterialFromDefinition(materialDefinition) -> material.Material
Parameters
materialDefinition
MaterialDefinitionThe 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
materialDefinitions
MaterialDefinitionListMaterial 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
directory
DirectoryPathDirectory path
exportImage
Export an image
material.exportImage(image, filename)
Parameters
image
ImageIdentifier of the image to export
filename
OutputFilePathFilename of the file to export
fillUnusedPixels
Fill unused pixels by propagating and averaging used pixels
material.fillUnusedPixels(image, unusedColor) -> material.Image
Parameters
image
ImageImage to process
unusedColor
ColorAlphaColor 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
aoMap
ImageInput AO Map (the alpha component must be set to 0 for unused pixels)
normalMap
ImageInput Normal Map (preferable to use a World space normal map, but an Object space normal map can be used)
sigmaPos
DoubleATrous Sigma pos
sigmaValue
DoubleATrous Sigma value
sigmaNormal
DoubleATrous Sigma normal
levelCount
IntAtrous #Levels
filterLowValues
BooleanRemove low values from the filtering (see: lowValuesThreshold parameter)
lowValueThreshold
DoubleThreshold 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
name
StringThe name of the material pattern
Returns
- CustomMaterialPattern
The material pattern
findMaterialsByPattern
Returns all materials using the given pattern
material.findMaterialsByPattern(pattern) -> material.MaterialList
Parameters
pattern
StringA material pattern
Returns
- MaterialList
Materials using the pattern
findMaterialsByProperty
Returns all materials which match a given property value
material.findMaterialsByProperty(propertyName, propertyValue, caseInsensitive) -> material.MaterialList
Parameters
propertyName
StringName of the property to match
propertyValue
RegexRegular expression to match for the property value
caseInsensitive
BoolIf True, the regex will be insensitive to upper and lower cases
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
materials
MaterialListMaterials 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
material
MaterialThe 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
material
MaterialCustom 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
image
ImageImage's definition
Returns
- ImageDefinition
Definition of the image
getImageDefinitions
Returns the raw data of a set of images
material.getImageDefinitions(images) -> material.ImageDefinitionList
Parameters
images
ImageListThe images
Returns
- ImageDefinitionList
Images's definitions
getImageSize
Returns the size of an image
material.getImageSize(image) -> core.Int, core.Int
Parameters
image
ImageThe 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
material
MaterialThe material to get properties
Returns
- ImpostorMaterialInfos
The getImpostorMaterialInfos properties
getMaterialDefinition
Returns the properties of a PBR Material
material.getMaterialDefinition(material) -> material.MaterialDefinition
Parameters
material
MaterialThe PBR Material
Returns
- MaterialDefinition
The PBR material definition
getMaterialDefinitions
Returns the properties of a set of PBR Materials
material.getMaterialDefinitions(materials) -> material.MaterialDefinitionList
Parameters
materials
MaterialListThe PBR Materials
Returns
- MaterialDefinitionList
The PBR Material definitions
getMaterialMainColor
Get the main color on any material pattern type
material.getMaterialMainColor(material) -> core.ColorAlpha
Parameters
material
MaterialThe material
Returns
- ColorAlpha
The main color
getMaterialPattern
Gets the MaterialPattern name of the material
material.getMaterialPattern(material) -> core.String
Parameters
material
MaterialThe 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
material
MaterialThe material to find the pattern
Returns
- MaterialPatternType
The pattern type of the material
getPBRMaterialInfos
Get PBR material properties
material.getPBRMaterialInfos(material) -> material.PBRMaterialInfos
Parameters
material
MaterialThe material to get properties
Returns
- PBRMaterialInfos
The PBRMaterialInfos properties
getPointsAndMaterialFromText
Returns list of 3D Points and a material from a string and fontname
material.getPointsAndMaterialFromText(text, fontName, fontSize, matrix, colorInput, offset, height3D) -> geom.Point3List, geom.Point2List, geom.Vector3, material.Material, core.Double
Parameters
text
StringInput text
fontName
StringFontname
fontSize
IntFontSize
matrix
Matrix4Input matrix for the text
colorInput
ColorColor of the font needed
offset
DoubleInput offset for the text
height3D
DoubleInput height in 3D which will be a ratio from the textSize
Returns
getStandardMaterialInfos
Get standard material properties
material.getStandardMaterialInfos(material) -> material.StandardMaterialInfos
Parameters
material
MaterialThe material to get properties
Returns
- StandardMaterialInfos
The StandardMaterialInfos properties
getUniformPropertyType
Get a shader uniform shader property type
material.getUniformPropertyType(pattern, name) -> material.ShaderUniformType
Parameters
pattern
CustomMaterialPatternThe custom pattern
name
StringName 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
material
MaterialThe material to get properties
Returns
- UnlitTextureMaterialInfos
The UnlitTextureMaterialInfos properties
importImage
Import an image
material.importImage(filename) -> material.Image
Parameters
filename
FilePathFilename of the image to import
Returns
- Image
Identifier of the imported image
isOpaque
Check if material is opaque
material.isOpaque(material) -> core.Boolean
Parameters
material
MaterialMaterial 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
materials
MaterialListMaterials 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
pattern
CustomMaterialPatternThe custom pattern to edit
code
StringThe GLSL code of the fragment shader
setMaterialMainColor
Set the main color on any material pattern type
material.setMaterialMainColor(material, color)
Parameters
material
MaterialThe material to apply the color on
color
ColorAlphaThe 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
material
MaterialThe material to set properties
infos
PBRMaterialInfosThe PBRMaterialInfos properties
setVertexShader
Set the vertex shader of a custom pattern
material.setVertexShader(pattern, code)
Parameters
pattern
CustomMaterialPatternThe custom pattern to edit
code
StringThe GLSL code of the vertex shader
updateImageFromDefinition
Update an image from its raw data
material.updateImageFromDefinition(image, imageDefinition)
Parameters
image
ImageThe image to update
imageDefinition
ImageDefinitionThe new data to apply
updateImagesFromDefinitions
Update images from their raw data
material.updateImagesFromDefinitions(image, imageDefinitions)
Parameters
image
ImageListThe image to update
imageDefinitions
ImageDefinitionListThe new data to apply
getMaterialUserData
Set or replace a userdata stored on an material
See also:
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.getMaterialUserData(userDataId, material) -> core.Ptr
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
material
MaterialMaterial that store the user data
Returns
- Ptr
User data stored in the given material
getMultipleMaterialUserData
Batch version of getMaterialUserData
See also:
- material.getMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.getMultipleMaterialUserData(userDataId, materials) -> core.PtrList
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materials
MaterialListMaterials that store the user data
Returns
- PtrList
User data stored for each given material
hasMaterialUserData
Set or replace a userdata stored on an material
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.hasMaterialUserData(userDataId, material) -> core.Bool
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
material
MaterialMaterial 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
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.hasMultipleMaterialUserData(userDataId, materials) -> core.BoolList
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materials
MaterialListMaterials 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
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.setMaterialUserData(userDataId, material, userData)
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
material
MaterialMaterial that will store the user data
userData
PtrUser data to store in the given material
setMultipleMaterialUserData
Batch version of setMaterialUserData
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.setMultipleMaterialUserData(userDataId, materials, userDataList)
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materials
MaterialListMaterials that will store the user data
userDataList
PtrListUser 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
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.subscribeToMaterialUserData() -> material.MaterialUserData
Returns
- MaterialUserData
UserData identifier to pass to setUserData/getUserData functions
unsetMaterialUserData
Unset the userdata stored on an material
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMultipleMaterialUserData
- material.unsubscribeFromMaterialUserData
material.unsetMaterialUserData(userDataId, material)
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
material
MaterialMaterial that will store the user data
unsetMultipleMaterialUserData
Batch version of unsetMaterialUserData
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsubscribeFromMaterialUserData
material.unsetMultipleMaterialUserData(userDataId, materials)
Parameters
userDataId
MaterialUserDataUserData identifier provided by subscribeToMaterialUserData
materials
MaterialListMaterials that will store the user data
unsubscribeFromMaterialUserData
See also:
- material.getMaterialUserData
- material.getMultipleMaterialUserData
- material.hasMaterialUserData
- material.hasMultipleMaterialUserData
- material.setMaterialUserData
- material.setMultipleMaterialUserData
- material.subscribeToMaterialUserData
- material.unsetMaterialUserData
- material.unsetMultipleMaterialUserData
material.unsubscribeFromMaterialUserData(userDataId)
Parameters
userDataId
MaterialUserDataUserData identifier to unsubscribe
ImageChanged
def onImageChanged(type, image):
pass
id = material.addImageChangedCallback(onImageChanged)
...
material.removeImageChangedCallback(id)
Parameters
type
ImageChangeTypeType of image change
image
ImageImage changed
MaterialChanged
def onMaterialChanged(type, material):
pass
id = material.addMaterialChangedCallback(onMaterialChanged)
...
material.removeMaterialChangedCallback(id)
Parameters
type
MaterialChangeTypeType of material change
material
MaterialMaterial changed