Skip to content

Commit

Permalink
Fix 3D object ordering when opacity is reduced
Browse files Browse the repository at this point in the history
Reducing opacity by any amount causes front 3D objects in Mayavi to appear behind deeper surfaces from some angles. Turn on depth peeling after rendering 3D surfaces or points to fix this ordering as described in this issue: enthought/mayavi#491 .
  • Loading branch information
yoda-vid committed Feb 9, 2021
1 parent a328222 commit 357a4cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions magmap/gui/vis_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def plot_3d_points(self, roi, channel, flipz=False):
pts.module_manager.scalar_lut_manager.lut.table = cmap(
range(0, 256)) * 255
self._resize_glyphs_isotropic(settings, pts)


# keep visual ordering of surfaces when opacity is reduced
self.scene.renderer.use_depth_peeling = True
print("time for 3D points display: {}".format(time() - time_start))
return True

Expand Down Expand Up @@ -278,7 +280,9 @@ def plot_3d_surface(self, roi, channel, segment=False, flipz=False):

self._resize_glyphs_isotropic(settings, surface)
surfaces.append(surface)


# keep visual ordering of surfaces when opacity is reduced
self.scene.renderer.use_depth_peeling = True
print("time to render 3D surface: {}".format(time() - time_start))
self.surfaces = surfaces
return surfaces
Expand Down

0 comments on commit 357a4cf

Please sign in to comment.