-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headless rendering EGL (without GLX) #7
Comments
@bhack Great link, thanks so much! Pyglet already had an EGL backend (I had a sample platform for it here), but it hasn't worked very stably as of yet. I'll be keeping an eye on this thread, and I'll add in support for hardware-accelerated headless rendering with EGL as soon as Pyglet supports it cleanly. Best, |
Cause:
But here i see 3.2: And shaders |
Hi @bhack, Thanks for the suggestion. After messing around a lot, I realized that I just had an NVIDIA driver issue with EGL on Ubuntu 16.04. I tried my EGL platform on Google CoLab and it works on newer Ubuntu versions (or if you install your drivers from a runfile). Check it out here. Does that work for you? |
This require email notification. Can you share in the repo or on gist? |
Oops so sorry, forgot to share the link! You should be able to access it now. Here's the code: # Render offscreen -- make sure to set the PyOpenGL platform
import os
os.environ["PYOPENGL_PLATFORM"] = "egl"
import numpy as np
import trimesh
import pyrender
# Load the FUZE bottle trimesh and put it in a scene
fuze_trimesh = trimesh.load('pyrender/examples/models/fuze.obj')
mesh = pyrender.Mesh.from_trimesh(fuze_trimesh)
scene = pyrender.Scene()
scene.add(mesh)
# Set up the camera -- z-axis away from the scene, x-axis right, y-axis up
camera = pyrender.PerspectiveCamera(yfov=np.pi / 3.0)
s = np.sqrt(2)/2
camera_pose = np.array([
[0.0, -s, s, 0.3],
[1.0, 0.0, 0.0, 0.0],
[0.0, s, s, 0.35],
[0.0, 0.0, 0.0, 1.0],
])
scene.add(camera, pose=camera_pose)
# Set up the light -- a single spot light in the same spot as the camera
light = pyrender.SpotLight(color=np.ones(3), intensity=3.0,
innerConeAngle=np.pi/16.0)
scene.add(light, pose=camera_pose)
# Render the scene
r = pyrender.OffscreenRenderer(640, 480)
color, depth = r.render(scene)
# Show the images
import matplotlib.pyplot as plt
plt.figure()
plt.subplot(1,2,1)
plt.axis('off')
plt.imshow(color)
plt.subplot(1,2,2)
plt.axis('off')
plt.imshow(depth, cmap=plt.cm.gray_r)
plt.show() |
Yes it is working correctly. |
Awesome, happy to hear that :) And yeah, obviously you won't want to use
matplotlib in a headless context. Out of curiosity, which flavor of Linux
are you using for your server?
…On Mon, Feb 25, 2019 at 11:47 AM bhack ***@***.***> wrote:
Yes it is working correctly.
Of course in need to use savefig in a headless context.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGNyRgi_kZPx-EO4iJJMyNniPHSP7UmSks5vRD3fgaJpZM4bOvwS>
.
|
I've tested on Ubuntu 16.04 |
If you are interested for the readme: |
Thanks so much! I'll close the issue for now. |
I am trying to use pyrender inside a docker image. I get the following error when I try to just import. If I try to import for the second time it goes through and then fails when creating offscreenrenderer. Any suggestions?
|
@arsalan-mousavian - I am having the same issue. Did you resolve it somehow, or open a new issue? (I am aware this one is closed). I have seen this post: |
I ended up creating my docker image based of https://hub.docker.com/r/nvidia/cudagl and fixed the issue. |
Thanks for the speedy reply, especially given that the last comment was over two months ago! Mine is also based on cudagl (have tried 10.0-devel and 10.0-base, to be specific). Could I ask which image you used? And, if possible (I realise time has passed) what apt install packages you used in the run file, in case this is ultimately some sort of missing library issue. |
|
For the benefit of anyone who reads this at a later date (relevant) - I gave up and switched to a different python package. I couldn't get any of the listed docker images to work for me. |
Haha I have no idea if it works with |
@mmatl I ran your EGL example, but get this error:
Do you know how to solve this problem? |
I have the same problem as @wangg12 :< |
My problem was gone by this. |
thak you very much , solve my problem |
For anyone who might run into this issue and find this issue from Googling: make sure you have |
I get the same error on ubuntu 18, cuda 10, pyrender 0.1.36 with pyopengl 1.30, any helps?
|
I have the same problem. Have you solved it? |
@mmatl Dear the link not exit do you solved in ubuntu 18.04 |
same issue |
Hello guys I met a similar issue with 'OpenGL.error.GLError: GLError( err = 12289', I was doing the offscreen rendering based on Pyrender. Now I solved this problem by calling render.delete(), so every time it will rebuild the rendering again and this issue disappeared. Hope it helps. |
where I add this code? could you please give us a example? |
Hi @lingtengqiu , I used the Pyrender example code from here https://pyrender.readthedocs.io/en/latest/examples/quickstart.html , and I added the render.delete() in the end of the script.
Hope it helps |
I confirm that this solved my problem. I used 11.3.0-devel |
If you are interested in EGL headless check https://bitbucket.org/pyglet/pyglet/issues/219/egl-support-headless-rendering
The text was updated successfully, but these errors were encountered: