eradiate.scenes.shapes.BufferMeshShape#
- class eradiate.scenes.shapes.BufferMeshShape(id='shape', bsdf=None, to_world=None, *, vertices, faces, texcoords=None)[source]#
Bases:
ShapeInstance
Buffer mesh shape [
buffer_mesh
].This shape represents a triangulated mesh directly defined by lists of vertex coordinates and face definitions.
- Parameters:
id (
str
, optional, default:"shape"
) – Identifier of the current scene element.bsdf (
BSDF
orRef
ordict
, optional) – BSDF attached to the shape. If a dictionary is passed, it is interpreted bybsdf_factory.convert()
. If unset, no BSDF will be specified during the kernel dictionary generation: the kernel’s default will be used. If aBSDF
instance (or a corresponding dictionary specification) is passed, its id member is automatically overridden.to_world (
mitsuba.ScalarTransform4f
or array-like, optional) – Transform to scale, shift and rotate the shape.vertices (array-like) – List of vertex coordinates, specified either as a (n, 3) NumPy array or a list of triplets.
Unit-enabled field (default: ucc[‘length’]).
faces (array-like) – List of face definitions, specified either as a (n, 3) NumPy array or a list of triplets of vertex indices.
texcoords (array-like) – List of vertex texture coordinates, specified either as a (n, 2) NumPy array or a list of pairs.
- Fields:
to_world (
mitsuba.ScalarTransform4f
orNone
) – Transform to scale, shift and rotate the shape.vertices (
quantity
) – List of vertex coordinates, specified either as a (n, 3) NumPy array or a list of triplets.faces (
ndarray
) – List of face definitions, specified either as a (n, 3) NumPy array or a list of triplets of vertex indices.texcoords (
ndarray
) – List of vertex texture coordinates, specified either as a (n, 2) NumPy array or a list of pairs.
Notes
This class does not support the
to_world
parameter: mesh vertices must be transformed manually.The optional
texcoords
field can hold a list of (u, v) texture coordinates in the same order as vertex coordinates.
- bbox()[source]#
BoundingBox
Shape bounding box. Default implementationraises a
NotImplementedError
.
- traverse(callback)#
Traverse this scene element and collect kernel dictionary template and parameter update map contributions.
- Parameters:
callback (
SceneTraversal
) – Callback data structure storing the collected data.
- update()#
Enforce internal state consistency. This method should be called when fields are modified. It is automatically called as a post-init step.
- write_ply(filename)[source]#
Write the mesh data to a PLY file.
- Parameters:
filename (
str
) – Path and filename to write the mesh file into. No directories are created.
Notes
Vertex coordinates are expressed in kernel units and accordingly prior to writing to disk. See the documentation of
eradiate.unit_context_kernel
and the Unit handling for users.
- property instance#
Mitsuba object which is represented by this scene element.
- Returns:
- property params#
- Returns:
dict[str
,UpdateParameter
] orNone
– A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.
See also