Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tweaks to adjust to new pygfx blending #838

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions fastplotlib/graphics/selectors/_base_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _fpl_add_plot_area_hook(self, plot_area):
wo.add_event_handler(self._toggle_arrow_key_moveable, "double_click")

for fill in self._fill:
if fill.material.color_is_transparent:
if fill.material.color.a < 1 or fill.material.opacity < 1:
self._pfunc_fill = partial(self._check_fill_pointer_event, fill)
self._plot_area.renderer.add_event_handler(
self._pfunc_fill, "pointer_down"
Expand Down Expand Up @@ -392,7 +392,6 @@ def _move_to_pointer(self, ev):
self._move_graphic(move_info)

def _pointer_enter(self, ev):

if self._hover_responsive is None:
return

Expand Down
5 changes: 5 additions & 0 deletions fastplotlib/layouts/_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ def _render(self, draw=True):
# draw the underlay planes
self.renderer.render(self._underlay_scene, self._underlay_camera, flush=False)

# With new pygfx' blending, the depth buffer is only cleared after each flush, we need a manual depth
# clear to erase the depth values set by the underlay.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the overlay?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, you may want to use a different depth range in the camera, so that the fragments all have a very small depth value, so they don't get behind stuff in the scene. Or simply disable depth-tests.

Copy link
Collaborator Author

@almarklein almarklein May 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can clear the depth buffer again, if you don't need it for post processing or things like that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are depth tests? Is there a performance difference between this or clearing again? What's your recommendation, I'm not too familiar with how the depth buffer works in this context, only how it's important for knowing what objects are above what in a 3D scene. Eventually the overlay scene will probably have axes when using an orthographic projection, along with legends etc.

if hasattr(self.renderer, "clear"):
self.renderer.clear(depth=True)

# call the animation functions before render
self._call_animate_functions(self._animate_funcs_pre)
for subplot in self:
Expand Down