Overview
PyTorch3D provides a modular differentiable renderer, but for instances where we want interactive plots or are not concerned with the differentiability of the rendering process, we provide functions to render meshes and pointclouds in plotly. These plotly figures allow you to rotate and zoom the rendered images and support plotting batched data as multiple traces in a singular plot or divided into individual subplots.
Examples
These rendering functions accept plotly x,y, and z axis arguments as kwargs
, allowing us to customize the plots. Here are two plots with colored axes, a Pointclouds plot, a batched Meshes plot in subplots, and a batched Meshes plot with multiple traces. Refer to the render textured meshes and render colored pointclouds tutorials for code examples.
Saving plots to images
If you want to save these plotly plots, you will need to install a separate library such as Kaleido.
Install Kaleido
$ pip install Kaleido
Export a figure as a .png image. The image will be saved in the current working directory.
fig = ...
fig.write_image("image_name.png")