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

Joint Rendering of the GPU Shader Module and Viewport #15

Open
SBCV opened this issue May 17, 2020 · 8 comments
Open

Joint Rendering of the GPU Shader Module and Viewport #15

SBCV opened this issue May 17, 2020 · 8 comments

Comments

@SBCV
Copy link
Owner

SBCV commented May 17, 2020

Currently, this addon uses the GPU Shader Module, i.e.

import gpu
from gpu_extras.batch import batch_for_shader

to draw point clouds in the 3D Viewport.

Unfortunately, it is not possible to render this content using Blender's default OpengGL renderer. See this question for more information.

Therefore, I'm looking for an alternative way to jointly render point clouds and other Blender elements (such as cameras, image planes) with correct occlusion.

Drawing cameras and image planes with the GPU module is theoretically possible. However, I can imagine that there are cleaner approaches to solve this issue.

@SBCV
Copy link
Owner Author

SBCV commented Jun 3, 2020

Update:
Following potential options did NOT work for me:

GPU Module https://docs.blender.org/api/current/gpu.html
The GPU Module has no access to other render buffers. When using offscreen.draw_view3d() there is no possibilty to acess the depth buffer, which is required to compute correct occlusions of the Blender environment (including camera cones etc) and the point cloud.

Custom Renderengine (https://docs.blender.org/api/current/bpy.types.RenderEngine.html):
The render engine itself does not draw the cameras (thus, can not be used to export the corresponding results).

@SBCV
Copy link
Owner Author

SBCV commented Jun 12, 2020

Update:
According to this thread, there will be a new point cloud object type.

Another reference here: https://developer.blender.org/T75717

@SBCV
Copy link
Owner Author

SBCV commented Aug 12, 2020

@SBCV
Copy link
Owner Author

SBCV commented Jan 4, 2021

bpy.ops.screen.screenshot provides a reasonable workaround. See this commit for more details.

@mquantin
Copy link

About that issue of joint rendering, I'm not sure I understood the proposed workaround.
Is it the export screenshot option of the openGL Panel ?
Is there a way to screeshot nothing of blender's GUI (panes, grid, axes, background color, etc) BUT the 3D objects (ie pointCloud and Mesh) ?

Or maybe a way to render blender elements through the GPU Shader Module, so they'll be included in the renderings of the pointCloud?

@SBCV
Copy link
Owner Author

SBCV commented Feb 17, 2021

About that issue of joint rendering, I'm not sure I understood the proposed workaround.
Is it the export screenshot option of the openGL Panel?

Yes, the screenshot option is the current workaround.

Is there a way to screeshot nothing of blender's GUI (panes, grid, axes, background color, etc) BUT the 3D objects (ie pointCloud and Mesh) ?

Yes, you can configure the view port overlay options - see the following image.

viewport_overlays_annotations

Or maybe a way to render blender elements through the GPU Shader Module, so they'll be included in the renderings of the pointCloud?

As far as I know, it is not possible to render the Blender elements with GPU Shader Module (however, I could be mistaken here).
If you have any experience regarding this issue, please let me know.

Alternatively, one could use the reconstructed camera properties to visualize the camera cones using a set of lines with a reasonable amount of work. However, I do not know if adding image planes / background images is possible at all.

@mquantin
Copy link

Thanks for your help. Great addon by the way.
Thank you for the advice. Now my 3D scene is much clearer: no more axes, grids etc.
Still remains the panes
panes
I unticked this option region overlap in preferences.
option
Then I got a clean image inside a frame.
frame

From this point, i can crope the frames in a batch process.... well it's a workaround!

@SBCV
Copy link
Owner Author

SBCV commented Feb 17, 2021

Thank you for posting this - I didn't know that this option existed.
I think we should add this information to the documentation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants