Depth peeling not functioning with xvfb
See original GitHub issueDescribe the bug, what’s wrong, and what you expect:
A clear and concise description of what the bug is.
I frequently use Pyvista to plot multiple 2D meshes on top of each other that are partially transparent. I find that the transparency only renders correctly when depth peeling is enabled. However, I recently needed to do some plotting on a remote machine (using xvfb) and find that transparent meshes will not render at all if depth peeling is enabled.
A clear and concise description of what you expected to happen.
I expect when using xvfb in conjunction with depth peeling on a headless machines for transparency/opacity to render correctly. I provide an example code below using the planefile example.
To Reproduce
Please include a code snippet to reproduce the bug in the block below:
"""
Test for opacity on headless machine
"""
import pyvista as pv
from pyvista import examples
pv.start_xvfb()
mesh = pv.read(examples.planefile)
plotter = pv.Plotter(off_screen=True)
plotter.enable_depth_peeling()
plotter.add_mesh(mesh, opacity=0.5)
plotter.show(screenshot='test.png')
Screenshots Resulting screenshot using the code above:
Screenshot with depth peeling disabled:
System Information: Please run the following code wherever you are experiencing the bug and paste the output below. This report helps us track down bugs and it is critical to addressing your bug:
# Get system info
import pyvista as pv
print(pv.Report())
--------------------------------------------------------------------------------
Date: Thu May 12 17:37:55 2022 PDT
OS : Linux
CPU(s) : 16
Machine : x86_64
Architecture : 64bit
RAM : 27.3 GiB
Environment : Python
File system : ext4
GPU Details : error
Python 3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:59)
[GCC 10.3.0]
pyvista : 0.34.0
vtk : 9.1.0
numpy : 1.22.3
imageio : 2.19.1
appdirs : 1.4.4
scooby : 0.5.12
matplotlib : 3.5.2
PyQt5 : 5.12.3
IPython : 7.33.0
scipy : 1.8.0
tqdm : 4.64.0
Issue Analytics
- State:
- Created a year ago
- Comments:8 (3 by maintainers)
Top GitHub Comments
Yes, OSMesa, see https://github.com/pyvista/pyvista-wheels
[Duplicating my 2 comments from https://github.com/enthought/mayavi/issues/1165]
TL;DR:
export GALLIUM_DRIVER=softpipe
fixes the problem.The problem appears to be with the renderer. When using
Xvfb
you don’t get the hardware support so even with a GPU on the headless machine you can’t use it (AFAICT). That means you’re using the software rendererllvmpipe
by default. This can be changed toswr
orsoftpipe
(I found this from here: https://www.paraview.org/Wiki/ParaView/ParaView_And_Mesa_3D). I couldn’t getswr
to work but setting it tosoftpipe
resolves the issue. Obviously don’t expect the performance to be good using this option.In an attempt to fix gpu support I tried running a full X server on my machine, which shows up as a process in
nvidia-smi
and gives meOpenGL renderer string: Quadro RTX 4000/PCIe/SSE2
as output toglxinfo | grep -i render
. However I still need this fix to use depth peeling, so I’m not actually sure if I’m getting any gpu rendering here or not.– Update – OK in a last attempt, I installed the
llvm-dev
package (https://docs.mesa3d.org/drivers/llvmpipe.html) and reinstalled all my conda packages. Nope,GALLIUM_DRIVER=llvmpipe
still fails underXvfb
.BUT (I’m sure coincidentally) now my gpu-aware Xorg server now renders correctly with any setting of
GALLIUM_DRIVER
(including the previously crashingswr
) so I appear to have at least got gpu rendering working.