pyrender icon indicating copy to clipboard operation
pyrender copied to clipboard

Add alpha channel if RenderFlags.RGBA is set

Open eyllanesc opened this issue 3 years ago • 4 comments

Fixes #209

eyllanesc avatar Mar 19 '22 03:03 eyllanesc

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 avatar Apr 05 '22 09:04 alon-ne

There's another issue about this, specifically with osmesa https://github.com/mmatl/pyrender/issues/137

alon-ne avatar Apr 05 '22 10:04 alon-ne

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

alon-ne avatar Apr 06 '22 11:04 alon-ne

Any progress here?

jkulhanek avatar Oct 05 '22 19:10 jkulhanek