MaterialX.PyMaterialXRender Module

Inheritance diagram of MaterialX.PyMaterialXRender

Core rendering support for MaterialX.

exception MaterialX.PyMaterialXRender.ExceptionRenderError

Bases: Exception

add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
class MaterialX.PyMaterialXRender.BaseType(self: MaterialX.PyMaterialXRender.BaseType, value: SupportsInt)

Bases: pybind11_object

Members:

UINT8

INT8

UINT16

INT16

HALF

FLOAT

FLOAT = <BaseType.FLOAT: 5>
HALF = <BaseType.HALF: 4>
INT16 = <BaseType.INT16: 3>
INT8 = <BaseType.INT8: 1>
UINT16 = <BaseType.UINT16: 2>
UINT8 = <BaseType.UINT8: 0>
BaseType.name -> str
property value
class MaterialX.PyMaterialXRender.Camera

Bases: pybind11_object

A simple camera class, supporting transform matrices and arcball functionality for object-viewing applications.

static create() MaterialX.PyMaterialXRender.Camera

Create a new camera.

static createOrthographicMatrix(arg0: SupportsFloat, arg1: SupportsFloat, arg2: SupportsFloat, arg3: SupportsFloat, arg4: SupportsFloat, arg5: SupportsFloat) MaterialX.PyMaterialXCore.Matrix44

Create an orthographic projection matrix given a set of clip planes with [-1,1] projected Z.

static createPerspectiveMatrix(arg0: SupportsFloat, arg1: SupportsFloat, arg2: SupportsFloat, arg3: SupportsFloat, arg4: SupportsFloat, arg5: SupportsFloat) MaterialX.PyMaterialXCore.Matrix44

Create a perspective projection matrix given a set of clip planes with [-1,1] projected Z.

static createViewMatrix(arg0: MaterialX.PyMaterialXCore.Vector3, arg1: MaterialX.PyMaterialXCore.Vector3, arg2: MaterialX.PyMaterialXCore.Vector3) MaterialX.PyMaterialXCore.Matrix44

Create a view matrix given an eye position, a target position and an up vector.

static transformPointPerspective(arg0: MaterialX.PyMaterialXCore.Matrix44, arg1: MaterialX.PyMaterialXCore.Vector3) MaterialX.PyMaterialXCore.Vector3

Apply a perspective transform to the given 3D point, performing a homogeneous divide on the transformed result.

getProjectionMatrix(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Matrix44

Return the projection matrix.

getViewDirection(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Vector3

Derive viewer direction from the view matrix.

getViewMatrix(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Matrix44

Return the view matrix.

getViewPosition(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Vector3

Derive viewer position from the view matrix.

getViewportSize(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Vector2

Return the size of the viewport window.

getWorldMatrix(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Matrix44

Return the world matrix.

getWorldViewProjMatrix(self: MaterialX.PyMaterialXRender.Camera) MaterialX.PyMaterialXCore.Matrix44

Compute our full model-view-projection matrix.

projectToViewport(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Vector3) MaterialX.PyMaterialXCore.Vector3

Project a position from object to viewport space.

setProjectionMatrix(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Matrix44) None

Set the projection matrix.

setViewMatrix(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Matrix44) None

Set the view matrix.

setViewportSize(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Vector2) None

Set the size of the viewport window.

setWorldMatrix(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Matrix44) None

Set the world matrix.

unprojectFromViewport(self: MaterialX.PyMaterialXRender.Camera, arg0: MaterialX.PyMaterialXCore.Vector3) MaterialX.PyMaterialXCore.Vector3

Unproject a position from viewport to object space.

class MaterialX.PyMaterialXRender.CgltfLoader(self: MaterialX.PyMaterialXRender.CgltfLoader)

Bases: GeometryLoader

Wrapper for loader to read in GLTF files using the Cgltf library.

static create() MaterialX.PyMaterialXRender.CgltfLoader

Create a new loader.

load(self: MaterialX.PyMaterialXRender.CgltfLoader, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: collections.abc.Sequence[MaterialX.PyMaterialXRender.Mesh], arg2: bool) bool

Load geometry from file path.

supportedExtensions(self: MaterialX.PyMaterialXRender.GeometryLoader) set[str]

Returns a list of supported extensions.

Returns:

List of support extensions

class MaterialX.PyMaterialXRender.GeometryHandler(self: MaterialX.PyMaterialXRender.GeometryHandler)

Bases: pybind11_object

Class which holds a set of geometry loaders.

Each loader is associated with a given set of file extensions.

static create() MaterialX.PyMaterialXRender.GeometryHandler

Create a new geometry handler.

addLoader(self: MaterialX.PyMaterialXRender.GeometryHandler, arg0: MaterialX.PyMaterialXRender.GeometryLoader) None

Add a geometry loader.

Parameters:

loader – Loader to add to list of available loaders.

clearGeometry(self: MaterialX.PyMaterialXRender.GeometryHandler) None

Clear all loaded geometry.

findParentMesh(self: MaterialX.PyMaterialXRender.GeometryHandler, arg0: MaterialX.PyMaterialXRender.MeshPartition) MaterialX.PyMaterialXRender.Mesh

Return the first mesh in our list containing the given partition.

If no matching mesh is found, then nullptr is returned.

getGeometry(self: MaterialX.PyMaterialXRender.GeometryHandler, arg0: collections.abc.Sequence[MaterialX.PyMaterialXRender.Mesh], arg1: str) None
getMaximumBounds(self: MaterialX.PyMaterialXRender.GeometryHandler) MaterialX.PyMaterialXCore.Vector3

Return the minimum bounds for all meshes.

getMeshes(self: MaterialX.PyMaterialXRender.GeometryHandler) list[MaterialX.PyMaterialXRender.Mesh]

Get list of meshes.

getMinimumBounds(self: MaterialX.PyMaterialXRender.GeometryHandler) MaterialX.PyMaterialXCore.Vector3

Return the minimum bounds for all meshes.

hasGeometry(self: MaterialX.PyMaterialXRender.GeometryHandler, arg0: str) bool
loadGeometry(self: MaterialX.PyMaterialXRender.GeometryHandler, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: bool) bool

Load geometry from a given location.

Parameters:
  • filePath – Path to geometry

  • texcoordVerticalFlip – Flip texture coordinates in V. Default is to not flip.

class MaterialX.PyMaterialXRender.GeometryLoader(self: MaterialX.PyMaterialXRender.GeometryLoader)

Bases: pybind11_object

Base class representing a geometry loader.

A loader can be associated with one or more file extensions.

load(self: MaterialX.PyMaterialXRender.GeometryLoader, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: collections.abc.Sequence[MaterialX.PyMaterialXRender.Mesh], arg2: bool) bool

Load geometry from disk.

Parameters:
  • filePath – Path to file to load

  • meshList – List of meshes to update

  • texcoordVerticalFlip – Flip texture coordinates in V when loading

Returns:

True if load was successful

supportedExtensions(self: MaterialX.PyMaterialXRender.GeometryLoader) set[str]

Returns a list of supported extensions.

Returns:

List of support extensions

class MaterialX.PyMaterialXRender.Image

Bases: pybind11_object

Class representing an image in system memory.

static create(arg0: SupportsInt, arg1: SupportsInt, arg2: SupportsInt, arg3: MaterialX.PyMaterialXRender.BaseType) MaterialX.PyMaterialXRender.Image

Create an empty image with the given properties.

applyBoxBlur(self: MaterialX.PyMaterialXRender.Image) MaterialX.PyMaterialXRender.Image

Apply a 3x3 box blur to this image, returning a new blurred image.

applyBoxDownsample(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsInt) MaterialX.PyMaterialXRender.Image

Downsample this image by an integer factor using a box filter, returning the new reduced image.

applyGammaTransform(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsFloat) None

Apply the given gamma transform to all texels of this image.

applyGaussianBlur(self: MaterialX.PyMaterialXRender.Image) MaterialX.PyMaterialXRender.Image

Apply a 7x7 Gaussian blur to this image, returning a new blurred image.

applyMatrixTransform(self: MaterialX.PyMaterialXRender.Image, arg0: MaterialX.PyMaterialXCore.Matrix33) None

Apply the given matrix transform to all texels of this image.

copy(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsInt, arg1: MaterialX.PyMaterialXRender.BaseType) MaterialX.PyMaterialXRender.Image

Create a copy of this image with the given channel count and base type.

createResourceBuffer(self: MaterialX.PyMaterialXRender.Image) None

Allocate a resource buffer for this image that matches its properties.

getBaseStride(self: MaterialX.PyMaterialXRender.Image) int

Return the stride of our base type in bytes.

getBaseType(self: MaterialX.PyMaterialXRender.Image) MaterialX.PyMaterialXRender.BaseType

Return the base type of the image.

getChannelCount(self: MaterialX.PyMaterialXRender.Image) int

Return the channel count of the image.

getHeight(self: MaterialX.PyMaterialXRender.Image) int

Return the height of the image.

getMaxMipCount(self: MaterialX.PyMaterialXRender.Image) int

Return the maximum number of mipmaps for this image.

getResourceBuffer(self: MaterialX.PyMaterialXRender.Image) int

Return the resource buffer for this image.

getResourceBufferDeallocator(self: MaterialX.PyMaterialXRender.Image) collections.abc.Callable[[typing_extensions.CapsuleType], None]

Return the resource buffer deallocator for this image.

getTexelColor(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsInt, arg1: SupportsInt) MaterialX.PyMaterialXCore.Color4

Return the texel color at the given coordinates.

If the coordinates or image resource buffer are invalid, then an exception is thrown.

getWidth(self: MaterialX.PyMaterialXRender.Image) int

Return the width of the image.

isUniformColor(self: MaterialX.PyMaterialXRender.Image, arg0: MaterialX.PyMaterialXCore.Color4) bool

Return true if all texels of this image are identical in color.

Parameters:

uniformColor – Return the uniform color of the image, if any.

releaseResourceBuffer(self: MaterialX.PyMaterialXRender.Image) None

Release the resource buffer for this image.

setResourceBuffer(self: MaterialX.PyMaterialXRender.Image, arg0: typing_extensions.CapsuleType) None

Set the resource buffer for this image.

setResourceBufferDeallocator(self: MaterialX.PyMaterialXRender.Image, arg0: collections.abc.Callable[[typing_extensions.CapsuleType], None]) None

Set the resource buffer deallocator for this image.

setTexelColor(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsInt, arg1: SupportsInt, arg2: MaterialX.PyMaterialXCore.Color4) None

Set the texel color at the given coordinates.

If the coordinates or image resource buffer are invalid, then an exception is thrown.

setUniformColor(self: MaterialX.PyMaterialXRender.Image, arg0: MaterialX.PyMaterialXCore.Color4) None

Set all texels of this image to a uniform color.

splitByLuminance(self: MaterialX.PyMaterialXRender.Image, arg0: SupportsFloat) tuple[MaterialX.PyMaterialXRender.Image, MaterialX.PyMaterialXRender.Image]

Split this image by the given luminance threshold, returning the resulting underflow and overflow images.

class MaterialX.PyMaterialXRender.ImageBufferDeallocator

Bases: pybind11_object

class MaterialX.PyMaterialXRender.ImageHandler

Bases: pybind11_object

Base image handler class.

Keeps track of images which are loaded from disk via supplied ImageLoader. Derived classes are responsible for determining how to perform the logic for “binding” of these resources for a given target (such as a given shading language).

static create(arg0: MaterialX.PyMaterialXRender.ImageLoader) MaterialX.PyMaterialXRender.ImageHandler
acquireImage(self: MaterialX.PyMaterialXRender.ImageHandler, filePath: MaterialX.PyMaterialXFormat.FilePath, defaultColor: MaterialX.PyMaterialXCore.Color4 = <MaterialX.PyMaterialXCore.Color4 object at 0x00000251BA562170>) MaterialX.PyMaterialXRender.Image

Acquire an image from the cache or file system.

Parameters:
  • filePath – File path of the image.

  • defaultColor – Default color to use as a fallback for missing images.

Returns:

On success, a shared pointer to the acquired image.

addLoader(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXRender.ImageLoader) None

Add another image loader to the handler, which will be invoked if existing loaders cannot load a given image.

bindImage(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXRender.Image, arg1: MaterialX.PyMaterialXRender.ImageSamplingProperties) bool

Bind an image for rendering.

Parameters:
  • image – The image to bind.

  • samplingProperties – Sampling properties for the image.

clearImageCache(self: MaterialX.PyMaterialXRender.ImageHandler) None

Clear the contents of the image cache, first releasing any render resources associated with cached images.

createRenderResources(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXRender.Image, arg1: bool, arg2: bool) bool

Create rendering resources for the given image.

getFilenameResolver(self: MaterialX.PyMaterialXRender.ImageHandler) MaterialX.PyMaterialXCore.StringResolver

Return the filename resolver for images.

getReferencedImages(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXCore.Document) list[MaterialX.PyMaterialXRender.Image]

Acquire all images referenced by the given document, and return the images in a vector.

getSearchPath(self: MaterialX.PyMaterialXRender.ImageHandler) MaterialX.PyMaterialXFormat.FileSearchPath

Return the image search path.

getZeroImage(self: MaterialX.PyMaterialXRender.ImageHandler) MaterialX.PyMaterialXRender.Image

Return a fallback image with zeroes in all channels.

releaseRenderResources(self: MaterialX.PyMaterialXRender.ImageHandler, image: MaterialX.PyMaterialXRender.Image = None) None

Release rendering resources for the given image, or for all cached images if no image pointer is specified.

saveImage(self: MaterialX.PyMaterialXRender.ImageHandler, filePath: MaterialX.PyMaterialXFormat.FilePath, image: MaterialX.PyMaterialXRender.Image, verticalFlip: bool = False) bool

Save image to disk.

Parameters:
  • filePath – File path to be written

  • image – The image to be saved

  • verticalFlip – Whether the image should be flipped in Y during save

Returns:

if save succeeded

setFilenameResolver(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXCore.StringResolver) None

Set the filename resolver for images.

setSearchPath(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXFormat.FileSearchPath) None

Set the search path to be used for finding images on the file system.

unbindImage(self: MaterialX.PyMaterialXRender.ImageHandler, arg0: MaterialX.PyMaterialXRender.Image) bool

Unbind an image, making it no longer active for rendering.

Parameters:

image – The image to unbind.

unbindImages(self: MaterialX.PyMaterialXRender.ImageHandler) None

Unbind all images that are currently stored in the cache.

class MaterialX.PyMaterialXRender.ImageLoader(self: MaterialX.PyMaterialXRender.ImageLoader)

Bases: pybind11_object

Abstract base class for file-system image loaders.

loadImage(self: MaterialX.PyMaterialXRender.ImageLoader, arg0: MaterialX.PyMaterialXFormat.FilePath) MaterialX.PyMaterialXRender.Image

Load an image from the file system.

Parameters:

filePath – The requested image file path.

Returns:

On success, a shared pointer to the loaded image; otherwise an empty shared pointer.

saveImage(self: MaterialX.PyMaterialXRender.ImageLoader, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: MaterialX.PyMaterialXRender.Image, arg2: bool) bool

Save an image to the file system.

Parameters:
  • filePath – File path to be written

  • image – The image to be saved

  • verticalFlip – Whether the image should be flipped in Y during save

Returns:

if save succeeded

supportedExtensions(self: MaterialX.PyMaterialXRender.ImageLoader) set[str]

Returns a list of supported extensions.

Returns:

List of support extensions

BMP_EXTENSION = 'bmp'
EXR_EXTENSION = 'exr'
GIF_EXTENSION = 'gif'
HDR_EXTENSION = 'hdr'
JPEG_EXTENSION = 'jpeg'
JPG_EXTENSION = 'jpg'
PIC_EXTENSION = 'pic'
PNG_EXTENSION = 'png'
PSD_EXTENSION = 'psd'
TGA_EXTENSION = 'tga'
TIFF_EXTENSION = 'tiff'
TIF_EXTENSION = 'tif'
TXT_EXTENSION = 'txt'
class MaterialX.PyMaterialXRender.ImageSamplingProperties

Bases: pybind11_object

Interface to describe sampling properties for images.

property defaultColor
property filterType
property uaddressMode
property vaddressMode
class MaterialX.PyMaterialXRender.LightHandler(self: MaterialX.PyMaterialXRender.LightHandler)

Bases: pybind11_object

Utility light handler for creating and providing light data for shader binding.

static create() MaterialX.PyMaterialXRender.LightHandler

Create a new light handler.

addLightSource(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX.PyMaterialXCore.Node) None

Add a light source.

computeLightIdMap(self: MaterialX.PyMaterialXRender.LightHandler, arg0: collections.abc.Sequence[MaterialX.PyMaterialXCore.Node]) dict[str, int]

From a set of nodes, create a mapping of corresponding nodedef identifiers to numbers.

findLights(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX.PyMaterialXCore.Document, arg1: collections.abc.Sequence[MaterialX.PyMaterialXCore.Node]) None

Find lights to use based on an input document.

Parameters:
  • doc – Document to scan for lights

  • lights – List of lights found in document

getAlbedoTable(self: MaterialX.PyMaterialXRender.LightHandler) MaterialX_v1_39_5::Image

Return the directional albedo table.

getDirectLighting(self: MaterialX.PyMaterialXRender.LightHandler) bool

Return whether direct lighting is enabled.

getEnvIrradianceMap(self: MaterialX.PyMaterialXRender.LightHandler) MaterialX_v1_39_5::Image

Return the environment irradiance map.

getEnvRadianceMap(self: MaterialX.PyMaterialXRender.LightHandler) MaterialX_v1_39_5::Image

Return the environment radiance map.

getEnvSampleCount(self: MaterialX.PyMaterialXRender.LightHandler) int

Return the environment lighting sample count.

getFirstLightOfCategory(self: MaterialX.PyMaterialXRender.LightHandler, arg0: str) MaterialX.PyMaterialXCore.Node

Return the first light source, if any, of the given category.

getIndirectLighting(self: MaterialX.PyMaterialXRender.LightHandler) bool

Return whether indirect lighting is enabled.

getLightIdMap(self: MaterialX.PyMaterialXRender.LightHandler) dict[str, int]

Get a list of identifiers associated with a given light nodedef.

getLightSources(self: MaterialX.PyMaterialXRender.LightHandler) list[MaterialX.PyMaterialXCore.Node]

Return the vector of light sources.

getLightTransform(self: MaterialX.PyMaterialXRender.LightHandler) MaterialX.PyMaterialXCore.Matrix44

Return the light transform.

getRefractionTwoSided(self: MaterialX.PyMaterialXRender.LightHandler) int

Return the two-sided refraction property.

registerLights(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX.PyMaterialXCore.Document, arg1: collections.abc.Sequence[MaterialX.PyMaterialXCore.Node], arg2: MaterialX.PyMaterialXGenShader.GenContext) None

Register light node definitions and light count with a given generation context.

Parameters:
  • doc – Document containing light nodes and definitions

  • lights – Lights to register

  • context – Context to update

setAlbedoTable(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX_v1_39_5::Image) None

Set the directional albedo table.

setDirectLighting(self: MaterialX.PyMaterialXRender.LightHandler, arg0: bool) None

Set whether direct lighting is enabled.

setEnvIrradianceMap(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX_v1_39_5::Image) None

Set the environment irradiance map.

setEnvRadianceMap(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX_v1_39_5::Image) None

Set the environment radiance map.

setEnvSampleCount(self: MaterialX.PyMaterialXRender.LightHandler, arg0: SupportsInt) None

Set the environment lighting sample count.

setIndirectLighting(self: MaterialX.PyMaterialXRender.LightHandler, arg0: bool) None

Set whether indirect lighting is enabled.

setLightSources(self: MaterialX.PyMaterialXRender.LightHandler, arg0: collections.abc.Sequence[MaterialX.PyMaterialXCore.Node]) None

Set the vector of light sources.

setLightTransform(self: MaterialX.PyMaterialXRender.LightHandler, arg0: MaterialX.PyMaterialXCore.Matrix44) None

Set the light transform.

setRefractionTwoSided(self: MaterialX.PyMaterialXRender.LightHandler, arg0: bool) None

Set the two-sided refraction property.

class MaterialX.PyMaterialXRender.Mesh(self: MaterialX.PyMaterialXRender.Mesh, arg0: str)

Bases: pybind11_object

Container for mesh data.

static create(arg0: str) MaterialX.PyMaterialXRender.Mesh

Create a new mesh.

addPartition(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshPartition) None

Add a partition.

addStream(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshStream) None

Add a mesh stream.

generateBitangents(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshStream, arg1: MaterialX.PyMaterialXRender.MeshStream) MaterialX.PyMaterialXRender.MeshStream

Generate bitangents from the given normals and tangents.

Parameters:
  • normalStream – Input normal stream

  • tangentStream – Input tangent stream

Returns:

The generated bitangent stream, on success; otherwise, a null pointer.

generateNormals(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshStream) MaterialX.PyMaterialXRender.MeshStream

Generate face normals from the given positions.

Parameters:

positionStream – Input position stream

Returns:

The generated normal stream

generateTangents(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshStream, arg1: MaterialX.PyMaterialXRender.MeshStream, arg2: MaterialX.PyMaterialXRender.MeshStream) MaterialX.PyMaterialXRender.MeshStream

Generate tangents from the given positions, normals, and texture coordinates.

Parameters:
  • positionStream – Input position stream

  • normalStream – Input normal stream

  • texcoordStream – Input texcoord stream

Returns:

The generated tangent stream, on success; otherwise, a null pointer.

generateTextureCoordinates(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXRender.MeshStream) MaterialX.PyMaterialXRender.MeshStream

Create texture coordinates from the given positions.

Parameters:

positionStream – Input position stream

Returns:

The generated texture coordinate stream

getMaximumBounds(self: MaterialX.PyMaterialXRender.Mesh) MaterialX.PyMaterialXCore.Vector3

Return the minimum bounds for the geometry.

getMinimumBounds(self: MaterialX.PyMaterialXRender.Mesh) MaterialX.PyMaterialXCore.Vector3

Return the minimum bounds for the geometry.

getName(self: MaterialX.PyMaterialXRender.Mesh) str

Return the name of this mesh.

getPartition(self: MaterialX.PyMaterialXRender.Mesh, arg0: SupportsInt) MaterialX.PyMaterialXRender.MeshPartition

Return a reference to a mesh partition.

getPartitionCount(self: MaterialX.PyMaterialXRender.Mesh) int

Return the number of mesh partitions.

getSourceUri(self: MaterialX.PyMaterialXRender.Mesh) str

Return the mesh’s source URI.

getSphereCenter(self: MaterialX.PyMaterialXRender.Mesh) MaterialX.PyMaterialXCore.Vector3

Return center of the bounding sphere.

getSphereRadius(self: MaterialX.PyMaterialXRender.Mesh) float

Return radius of the bounding sphere.

getStream(*args, **kwargs)

Overloaded function.

  1. getStream(self: MaterialX.PyMaterialXRender.Mesh, arg0: str) -> MaterialX.PyMaterialXRender.MeshStream

  2. getStream(self: MaterialX.PyMaterialXRender.Mesh, arg0: str, arg1: typing.SupportsInt) -> MaterialX.PyMaterialXRender.MeshStream

getVertexCount(self: MaterialX.PyMaterialXRender.Mesh) int

Get vertex count.

hasSourceUri(self: MaterialX.PyMaterialXRender.Mesh) bool

Return true if this mesh has a source URI.

mergePartitions(self: MaterialX.PyMaterialXRender.Mesh) None

Merge all mesh partitions into one.

setMaximumBounds(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXCore.Vector3) None

Set the minimum bounds for the geometry.

setMinimumBounds(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXCore.Vector3) None

Set the minimum bounds for the geometry.

setSourceUri(self: MaterialX.PyMaterialXRender.Mesh, arg0: str) None

Set the mesh’s source URI.

setSphereCenter(self: MaterialX.PyMaterialXRender.Mesh, arg0: MaterialX.PyMaterialXCore.Vector3) None

Set center of the bounding sphere.

setSphereRadius(self: MaterialX.PyMaterialXRender.Mesh, arg0: SupportsFloat) None

Set radius of the bounding sphere.

setVertexCount(self: MaterialX.PyMaterialXRender.Mesh, arg0: SupportsInt) None

Set vertex count.

splitByUdims(self: MaterialX.PyMaterialXRender.Mesh) None

Split the mesh into a single partition per UDIM.

class MaterialX.PyMaterialXRender.MeshPartition(self: MaterialX.PyMaterialXRender.MeshPartition)

Bases: pybind11_object

Class that describes a sub-region of a mesh using vertex indexing.

Note that a face is considered to be a triangle.

static create() MaterialX.PyMaterialXRender.MeshPartition

Create a new mesh partition.

addSourceName(self: MaterialX.PyMaterialXRender.MeshPartition, arg0: str) None

Add a source name, representing a partition that was processed to generate this one.

getFaceCount(self: MaterialX.PyMaterialXRender.MeshPartition) int

Return number of faces.

getIndices(self: MaterialX.PyMaterialXRender.MeshPartition) list[int]
getName(self: MaterialX.PyMaterialXRender.MeshPartition) str

Return the name of this partition.

getSourceNames(self: MaterialX.PyMaterialXRender.MeshPartition) set[str]

Return the vector of source names, representing all partitions that were processed to generate this one.

resize(self: MaterialX.PyMaterialXRender.MeshPartition, arg0: SupportsInt) None

Resize data to the given number of indices.

setFaceCount(self: MaterialX.PyMaterialXRender.MeshPartition, arg0: SupportsInt) None

Set face count.

setName(self: MaterialX.PyMaterialXRender.MeshPartition, arg0: str) None

Set the name of this partition.

class MaterialX.PyMaterialXRender.MeshStream(self: MaterialX.PyMaterialXRender.MeshStream, arg0: str, arg1: str, arg2: SupportsInt)

Bases: pybind11_object

Class to represent a mesh data stream.

static create(arg0: str, arg1: str, arg2: SupportsInt) MaterialX.PyMaterialXRender.MeshStream

Create a new mesh stream.

getData(self: MaterialX.PyMaterialXRender.MeshStream) list[float]
getIndex(self: MaterialX.PyMaterialXRender.MeshStream) int

Get stream index.

getName(self: MaterialX.PyMaterialXRender.MeshStream) str

Get stream name.

getSize(self: MaterialX.PyMaterialXRender.MeshStream) int

Get the number of elements.

getStride(self: MaterialX.PyMaterialXRender.MeshStream) int

Get stride between elements.

getType(self: MaterialX.PyMaterialXRender.MeshStream) str

Get stream attribute name.

reserve(self: MaterialX.PyMaterialXRender.MeshStream, arg0: SupportsInt) None

Reserve memory for a given number of elements.

resize(self: MaterialX.PyMaterialXRender.MeshStream, arg0: SupportsInt) None

Resize data to an given number of elements.

setStride(self: MaterialX.PyMaterialXRender.MeshStream, arg0: SupportsInt) None

Set stride between elements.

transform(self: MaterialX.PyMaterialXRender.MeshStream, arg0: MaterialX.PyMaterialXCore.Matrix44) None

Transform elements by a matrix.

BITANGENT_ATTRIBUTE = 'bitangent'
COLOR_ATTRIBUTE = 'color'
GEOMETRY_PROPERTY_ATTRIBUTE = 'geomprop'
NORMAL_ATTRIBUTE = 'normal'
POSITION_ATTRIBUTE = 'position'
TANGENT_ATTRIBUTE = 'tangent'
TEXCOORD_ATTRIBUTE = 'texcoord'
class MaterialX.PyMaterialXRender.ShaderRenderer

Bases: pybind11_object

Base class for renderers that generate shader code to produce images.

createProgram(*args, **kwargs)

Overloaded function.

  1. createProgram(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXGenShader.Shader) -> None

  2. createProgram(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: collections.abc.Mapping[str, str]) -> None

getCamera(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.Camera

Return the camera.

getGeometryHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.GeometryHandler

Return the geometry handler.

getImageHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.ImageHandler

Return the image handler.

getLightHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer) MaterialX.PyMaterialXRender.LightHandler

Return the light handler.

initialize(self: MaterialX.PyMaterialXRender.ShaderRenderer, renderContextHandle: typing_extensions.CapsuleType = None) None

Initialize the renderer.

render(self: MaterialX.PyMaterialXRender.ShaderRenderer) None

Render the current program to produce an image.

setCamera(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.Camera) None

Set the camera.

setGeometryHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.GeometryHandler) None

Set the geometry handler.

setImageHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.ImageHandler) None

Set the image handler used by this renderer for image I/O.

setLightHandler(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: MaterialX.PyMaterialXRender.LightHandler) None

Set the light handler used by this renderer for light bindings.

setSize(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: SupportsInt, arg1: SupportsInt) None

Set the size of the rendered image.

updateUniform(self: MaterialX.PyMaterialXRender.ShaderRenderer, arg0: str, arg1: MaterialX.PyMaterialXCore.Value) None

Update the program with value of the uniform.

validateInputs(self: MaterialX.PyMaterialXRender.ShaderRenderer) None

Validate inputs for the program.

class MaterialX.PyMaterialXRender.StbImageLoader

Bases: ImageLoader

Stb image file loader.

static create() MaterialX.PyMaterialXRender.StbImageLoader

Create a new stb image loader.

loadImage(self: MaterialX.PyMaterialXRender.StbImageLoader, arg0: MaterialX.PyMaterialXFormat.FilePath) MaterialX.PyMaterialXRender.Image

Load an image from the file system.

saveImage(self: MaterialX.PyMaterialXRender.StbImageLoader, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: MaterialX.PyMaterialXRender.Image, arg2: bool) bool

Save an image to the file system.

supportedExtensions(self: MaterialX.PyMaterialXRender.ImageLoader) set[str]

Returns a list of supported extensions.

Returns:

List of support extensions

BMP_EXTENSION = 'bmp'
EXR_EXTENSION = 'exr'
GIF_EXTENSION = 'gif'
HDR_EXTENSION = 'hdr'
JPEG_EXTENSION = 'jpeg'
JPG_EXTENSION = 'jpg'
PIC_EXTENSION = 'pic'
PNG_EXTENSION = 'png'
PSD_EXTENSION = 'psd'
TGA_EXTENSION = 'tga'
TIFF_EXTENSION = 'tiff'
TIF_EXTENSION = 'tif'
TXT_EXTENSION = 'txt'
class MaterialX.PyMaterialXRender.TinyObjLoader(self: MaterialX.PyMaterialXRender.TinyObjLoader)

Bases: GeometryLoader

Wrapper for geometry loader to read in OBJ files using the TinyObj library.

static create() MaterialX.PyMaterialXRender.TinyObjLoader

Create a new TinyObjLoader.

load(self: MaterialX.PyMaterialXRender.TinyObjLoader, arg0: MaterialX.PyMaterialXFormat.FilePath, arg1: collections.abc.Sequence[MaterialX.PyMaterialXRender.Mesh], arg2: bool) bool

Load geometry from disk.

supportedExtensions(self: MaterialX.PyMaterialXRender.GeometryLoader) set[str]

Returns a list of supported extensions.

Returns:

List of support extensions

MaterialX.PyMaterialXRender.createImageStrip(arg0: collections.abc.Sequence[MaterialX.PyMaterialXRender.Image]) MaterialX.PyMaterialXRender.Image

Create a horizontal image strip from a vector of images with identical resolutions and formats.

MaterialX.PyMaterialXRender.createUniformImage(arg0: SupportsInt, arg1: SupportsInt, arg2: SupportsInt, arg3: MaterialX.PyMaterialXRender.BaseType, arg4: MaterialX.PyMaterialXCore.Color4) MaterialX.PyMaterialXRender.Image

Create a uniform-color image with the given properties.

MaterialX.PyMaterialXRender.getMaxDimensions(arg0: collections.abc.Sequence[MaterialX.PyMaterialXRender.Image]) tuple[int, int]

Compute the maximum width and height of all images in the given vector.