trimesh
trimesh copied to clipboard
How to save a scene without display?
Hello and thanks a lot for immense work you are putting in this project.
I wanted to ask if there is a way to plot scene without save_image method?
In my case I am running my project on GitLab CI docker, thus it does not have display as we can see from thrown exception. Setting visible=False returns blank image.
The question is how to plot scene in other way or are there any workarounds for this?
Thrown exception
Traceback (most recent call last):
File "/code/src/demos/aria_axes_demo.py", line 94, in save_scene
png = scene.save_image(resolution=resolution, visible=True)
File "/usr/local/lib/python3.6/dist-packages/trimesh/scene/scene.py", line 812, in save_image
**kwargs)
File "/usr/local/lib/python3.6/dist-packages/trimesh/viewer/windowed.py", line 875, in render_scene
**kwargs)
File "/usr/local/lib/python3.6/dist-packages/trimesh/viewer/windowed.py", line 161, in __init__
caption=caption)
File "/usr/local/lib/python3.6/dist-packages/pyglet/window/xlib/__init__.py", line 173, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pyglet/window/__init__.py", line 585, in __init__
display = pyglet.canvas.get_display()
File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/__init__.py", line 94, in get_display
return Display()
File "/usr/local/lib/python3.6/dist-packages/pyglet/canvas/xlib.py", line 123, in __init__
raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"
Yeah, unfortunately save_image is pretty unreliable in general because of platform differences. I've found the most reliable thing for headless rendering in general is using LLVMpipe software rasterization which works pretty well, here's a docker example: https://github.com/mikedh/trimesh/tree/master/examples/dockerRender
Hi, why is it using supervisord? Is it necessary to get it working?
PYGLET_HEADLESS=1 environment variable may work on Linux platforms. It at least works on my Linux workstation connected via SSH tunnels.
P.S. sorry for the thread necromancy, but this issue pops at the first place of my google search results, and I feel someone else who bump into this page may find this useful.