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

Add alpha channel if RenderFlags.RGBA is set #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eyllanesc
Copy link

@eyllanesc eyllanesc commented Mar 19, 2022

Fixes #209

@eyllanesc eyllanesc changed the title Fixes #209 Add alpha channel if RenderFlags.RGBA is set Mar 19, 2022
@alon-ne
Copy link

alon-ne commented Apr 5, 2022

Hey Edwin, I also ran into the issue that I get RGB instead of RGBA, specifically when I use osmesa on mac (running with the normal graphics adaptor I got RGBA as expected).
I validated that running on linux with osmesa, the issue is indeed resolved, thank you!

On mac with osmesa however, I tried using this branch and it indeed produced an RGBA image, but it's cut so I see only the lower-left quarter. Here's a snippet of my code

            scene = pyrender.Scene.from_trimesh_scene(self.glb, bg_color=[0] * 4, ambient_light=[255] * 3)
            scene.add(self._camera(), pose=self.glb.camera_transform)

            renderer = pyrender.OffscreenRenderer(width, height)
            thumbnail, _ = renderer.render(scene, RenderFlags.RGBA)
            thumbnail_filename = self._thumbnail_filename(destination)
            Image.fromarray(thumbnail).save(thumbnail_filename)

@alon-ne
Copy link

alon-ne commented Apr 5, 2022

There's another issue about this, specifically with osmesa
#137

@alon-ne
Copy link

alon-ne commented Apr 6, 2022

Attaching an example image produced by this code, when run with PYOPENGL_PLATFORM=osmesa it's cut, but without the environment variable it's not cut.
Duck_not_cut
Duck_cut

@jkulhanek
Copy link

Any progress here?

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

Successfully merging this pull request may close these issues.

pyrender OffScreen set Alpha channel get only 3 channels output
3 participants