pyvista.Renderer.set_environment_texture

pyvista.Renderer.set_environment_texture#

Renderer.set_environment_texture(texture, is_srgb=False) None[source]#

Set the environment texture used for image based lighting.

This texture is supposed to represent the scene background. If it is not a cubemap, the texture is supposed to represent an equirectangular projection. If used with raytracing backends, the texture must be an equirectangular projection and must be constructed with a valid vtk.vtkImageData.

Parameters:
texturepyvista.Texture

Texture.

is_srgbbool, default: False

If the texture is in sRGB color space, set the color flag on the texture or set this parameter to True. Textures are assumed to be in linear color space by default.

Examples

Add a skybox cubemap as an environment texture and show that the lighting from the texture is mapped on to a sphere dataset. Note how even when disabling the default lightkit, the scene lighting will still be mapped onto the actor.

>>> from pyvista import examples
>>> import pyvista as pv
>>> pl = pv.Plotter(lighting=None)
>>> cubemap = examples.download_sky_box_cube_map()
>>> _ = pl.add_mesh(
...     pv.Sphere(), pbr=True, metallic=0.9, roughness=0.4
... )
>>> pl.set_environment_texture(cubemap)
>>> pl.camera_position = 'xy'
>>> pl.show()
../../../_images/pyvista-Renderer-set_environment_texture-1_00_00.png