Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

RGBA flag fails when using osmesa backend #137

Open
Hellomodo opened this issue Aug 26, 2020 · 10 comments
Open

RGBA flag fails when using osmesa backend #137

Hellomodo opened this issue Aug 26, 2020 · 10 comments

Comments

@Hellomodo
Copy link

Hellomodo commented Aug 26, 2020

Following #4, I set the bg_color and RenderFlags as follow, but the output color has a shape of h x w x 3 (h x w x 4 is expected).
scene = pyrender.Scene(bg_color=[1.0, 1.0, 1.0, 0.0]) \ flags = pyrender.RenderFlags.RGBA \ r = pyrender.OffscreenRenderer(h, w) \ color, depth = r.render(scene, flags=flags)

Additionally, I set os.environ["PYOPENGL_PLATFORM"] = "osmesa", which is the only difference between my testing script with other demo (https://github.com/JonathanLehner/Colab-collection/blob/master/pyrender_hand.ipynb).

@VVingerfly
Copy link

Hi, @Hellomodo

I met the same problem, have solved this problem?

B.R.

@Hellomodo
Copy link
Author

Not yet, I have to use EGL backend。

@slowpokefarm
Copy link

Same issue here. Any solution yet?

@indigo-99
Copy link

Same issue !! Any solution yet?

@alon-ne
Copy link

alon-ne commented Apr 4, 2022

Hi, I also have this issue

@zzharsky
Copy link

having the same issue. any ideas about workarounds? using a server without GPU, so EGL is not an option

@zzharsky
Copy link

@mmatl can you please comment? any chance this will be solved?

@Darius-H
Copy link

Darius-H commented Nov 6, 2023

bug not fixed yet

@masonwang513
Copy link

This works:

rgb, depth = render.render(scene)
alpha = depth > 0

@ZoidbergPi
Copy link

color_im, depth_im = r.render(scene, flags=pyrender.RenderFlags.RGBA)
threshold = 1.0
alpha_channel = np.where(depth_im < threshold, 0, 255).astype(np.uint8)
color_with_alpha = np.dstack((color_im[:, :, :3], alpha_channel))
image = Image.fromarray(color_with_alpha)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants