pyvista.Renderer.enable_ssao

pyvista.Renderer.enable_ssao#

Renderer.enable_ssao(radius=0.5, bias=0.005, kernel_size=256, blur=True) None[source]#

Enable surface space ambient occlusion (SSAO).

SSAO can approximate shadows more efficiently than ray-tracing and produce similar results. Use this when you wish to plot the occlusion effect that nearby meshes have on each other by blocking nearby light sources.

See Kitware: Screen-Space Ambient Occlusion for more details

Parameters:
radiusfloat, default: 0.5

Neighbor pixels considered when computing the occlusion.

biasfloat, default: 0.005

Tolerance factor used when comparing pixel depth.

kernel_sizeint, default: 256

Number of samples used. This controls the quality where a higher number increases the quality at the expense of computation time.

blurbool, default: True

Controls if occlusion buffer should be blurred before combining it with the color buffer.

Examples

Generate a pyvista.UnstructuredGrid with many tetrahedrons nearby each other and plot it without SSAO.

>>> import pyvista as pv
>>> ugrid = pv.ImageData(dimensions=(3, 2, 2)).to_tetrahedra(12)
>>> exploded = ugrid.explode()
>>> exploded.plot()
../../../_images/pyvista-Renderer-enable_ssao-1_00_00.png

Enable SSAO with the default parameters.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(exploded)
>>> pl.enable_ssao()
>>> pl.show()
../../../_images/pyvista-Renderer-enable_ssao-1_01_00.png