Skip to content

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?

gard-n added a commit to gard-n/pyrender that referenced this pull request May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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