pyvista.Plotter.set_environment_texture#
- Plotter.set_environment_texture( ) 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:
- texture
pyvista.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.- resamplebool |
float
,optional
Resample the environment texture. Set this to a float to set the sampling rate explicitly or set to
True
to downsample the texture to 1/16th of its original resolution. By default, the theme value forresample_environment_texture
is used, which isFalse
for the standard theme.Downsampling the texture can substantially improve performance for some environments, e.g. headless setups or if GPU support is limited.
Note
This will resample the texture used for image-based lighting only, e.g. the texture used for rendering reflective surfaces. It does not resample the background texture.
Added in version 0.45.
- texture
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()