Blurring#
Download Python source code | Download Jupyter notebook
Blur a plot, or highlight part of it, using depth-of-field style effects.
Uses add_blurring or
enable_depth_of_field.
import pyvista as pv
Create Several Spheres#
# We use a uniform grid here simply to create equidistantly spaced points for
# our glyph filter
grid = pv.ImageData(dimensions=(4, 4, 4), spacing=(1, 1, 1))
spheres = grid.glyph(geom=pv.Sphere(), scale=False, orient=False)
Blur the Plot#
Add a few blur passes to blur the plot
pl = pv.Plotter()
pl.add_mesh(spheres, smooth_shading=True, show_edges=True)
pl.add_blurring()
pl.add_blurring()
pl.add_blurring()
pl.camera.zoom(1.5)
pl.enable_anti_aliasing('ssaa')
pl.show()

Note how this is different than selectively blurring part of the mesh behind the focal plane
pl = pv.Plotter()
pl.add_mesh(spheres, smooth_shading=True, show_edges=True)
pl.enable_depth_of_field()
pl.camera.zoom(1.5)
pl.enable_anti_aliasing('ssaa')
pl.show()
Total running time of the script: (0 minutes 2.237 seconds)