eradiate.scenes.shapes.BufferMeshShape#

class eradiate.scenes.shapes.BufferMeshShape(id='shape', bsdf=None, *, vertices, faces)[source]#

Bases: ShapeInstance

Buffer mesh shape [buffer_mesh].

This shape represents a triangulated mesh directly defined by lists of vertex positions and faces.

Parameters:
  • id (str, optional, default: "shape") – Identifier of the current scene element.

  • bsdf (BSDF or Ref or dict, optional) – BSDF attached to the shape. If a dictionary is passed, it is interpreted by bsdf_factory.convert(). If unset, no BSDF will be specified during the kernel dictionary generation: the kernel’s default will be used. If a BSDF instance (or a corresponding dictionary specification) is passed, its id member is automatically overridden.

  • 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.

Fields:
  • id (str or None) – Identifier of the current scene element.

  • bsdf (BSDF or Ref or None) – BSDF attached to 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.

bbox()[source]#
BoundingBoxShape bounding box. Default implementation

raises 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:

mitsuba.Object

property params#
Returns:

dict[str, UpdateParameter] or None – A dictionary mapping parameter paths, consisting of dot-separated strings, to a corresponding update protocol.