This type of viewport layer lets you write your own Python script function to paint arbitrary text and graphics on top of images rendered in OVITO. This makes it possible to enrich figures or movies with additional information (e.g. a scale bar or a data plot).
This function will be invoked by OVITO each time the viewport is repainted or
whenever an image or movie frame is being rendered. The function parameter
gives access to a
which allows issueing arbitrary drawing commands to paint over the three-dimensional objects rendered by OVITO.
Any Python exceptions that raised during script execution are displayed in the output area below.
It also shows any output from calls to the
print() Python function.
The user-defined script has full access to OVITO's data model and can access viewport properties, camera and animation settings, modifiers, and data pipeline outputs. For more information on OVITO's Python interface and the object model, see the scripting reference.
This page provides several code examples
demonstrating how to write a
render() function for a Python viewport layer: