Plotter.export_gltf(filename, inline_data=True, rotate_scene=True, save_normals=True)#

Export the current rendering scene as a glTF file.

Visit https://gltf-viewer.donmccurdy.com/ for an online viewer.

See https://vtk.org/doc/nightly/html/classvtkGLTFExporter.html for limitations regarding the exporter.


Path to export the gltf file to.

inline_databool, optional

Sets if the binary data be included in the json file as a base64 string. When True, only one file is exported.

rotate_scenebool, optional

Rotate scene to be compatible with the glTF specifications.

save_normalsbool, optional

Saves the point array 'Normals' as 'NORMAL' in the outputted scene.


The VTK exporter only supports pyvista.PolyData datasets. If the plotter contains any non-PolyData datasets, these will be converted in the plotter, leading to a copy of the data internally.


Output a simple point cloud represented as balls.

>>> import numpy as np
>>> import pyvista
>>> point_cloud = np.random.random((100, 3))
>>> pdata = pyvista.PolyData(point_cloud)
>>> pdata['orig_sphere'] = np.arange(100)
>>> sphere = pyvista.Sphere(radius=0.02)
>>> pc = pdata.glyph(scale=False, geom=sphere, orient=False)
>>> pl = pyvista.Plotter()
>>> _ = pl.add_mesh(pc, cmap='reds', smooth_shading=True,
...                 show_scalar_bar=False)
>>> pl.export_gltf('balls.gltf')  
>>> pl.show()

Output the orientation plotter.

>>> from pyvista import demos
>>> pl = demos.orientation_plotter()
>>> pl.export_gltf('orientation_plotter.gltf')  
>>> pl.show()