Skip to content
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

Where to find rendered face normals data #192

Open
manuel-koch opened this issue Jun 11, 2021 · 1 comment
Open

Where to find rendered face normals data #192

manuel-koch opened this issue Jun 11, 2021 · 1 comment

Comments

@manuel-koch
Copy link

I'm trying to get normals data after scene has been rendered using flags with RenderFlags.FACE_NORMALS.

My naive code example looks like

r = pyrender.OffscreenRenderer(offscreen_width, offscreen_height)
rgb_data, depth_data = r.render(scene, flags=RenderFlags.FACE_NORMALS)
img = Image.fromarray(rgb_data)
img.save(f"output.png")

The saved image is the "normal" rendered image - where can I find the data of the face normals as requested by the supplied flags ?
I've debugged the renderer and stepped thru code that apparently did render something related to face normals.
But I couldn't figure out how to get that rendered face normals data.

Any hint appreciated !

@manuel-koch
Copy link
Author

Using additionally the following snippet seems to get an image that has face normals as additional drawing on top of normaly rendered image.

rgb_normals_data, _ = r._renderer._read_main_framebuffer(scene, flags=RenderFlags.FACE_NORMALS)                                                      

But I want the normals data directly, not something drawn on top of the rendered image.

I found this ticket ( #39 ) that seems to provide what I expect.
Is there any other built-in way to get the plain face-normals-buffer like the depth-buffer that gets returned by the renderer ?

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

No branches or pull requests

1 participant