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

Polygon faces in Shapes layer are not shown in 3D if not contained in an *axis-orthogonal* plane #6860

Open
jni opened this issue Apr 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jni
Copy link
Member

jni commented Apr 22, 2024

🐛 Bug Report

If I make polygons that are planar but not on a single z (or whatever) plane, the faces of the polygon are not rendered, only the edges.

💡 Steps to Reproduce

import napari

viewer = napari.Viewer()
poly0 = [[0, 0, 0], [0, 1, 1], [1, 1, 1], [1, 0, 0]]
poly1 = [[2, 2, 2], [3, 3, 3], [3, 2, 2]]
viewer.add_shapes(
        [poly0, poly1],
        shape_type='polygon',
        edge_width=0.1,
        face_color='white',
        )

viewer.dims.ndisplay = 3
viewer.camera.angles = (-35, 50, 35)
viewer.camera.zoom = 150

napari.run()

Result:

Screenshot 2024-04-22 at 10 11 49 AM

💡 Expected Behavior

The face color of the polygons should be white as specified.

🌎 Environment

napari: 0.5.0a2.dev640+gbdf6d644b
Platform: macOS-14.4-arm64-arm-64bit
System: MacOS 14.4
Python: 3.11.9 | packaged by conda-forge | (main, Apr 19 2024, 18:34:54) [Clang 16.0.6 ]
Qt: 5.15.8
PyQt5: 5.15.9
NumPy: 1.26.4
SciPy: 1.13.0
Dask: 2024.4.2
VisPy: 0.14.2
magicgui: 0.8.2
superqt: 0.6.3
in-n-out: 0.2.0
app-model: 0.2.6
npe2: 0.7.5

OpenGL:

  • GL version: 2.1 Metal - 88
  • MAX_TEXTURE_SIZE: 16384
  • GL_MAX_3D_TEXTURE_SIZE: 2048

Screens:

  • screen 1: resolution 1800x1169, scale 2.0

Optional:

  • numba not installed
  • triangle not installed

Settings path:

  • /Users/jni/Library/Application Support/napari/all_f206df4881e2999baa22e6df448393db299c70d6/settings.yaml
    Plugins:
  • napari: 0.5.0a2.dev640+gbdf6d644b (81 contributions)
  • napari-console: 0.0.9 (0 contributions)
  • napari-svg: 0.1.10 (2 contributions)

💡 Additional Context

I expect that this is a case of "we did the easy thing and left the hard thing till later" — only display polygons that are "easy" ie orthogonal planes, since the triangulation libraries are 2D-only. But polygons with co-planar vertices should be displayed correctly also. We could project them onto a 2D plane, do the 2D triangulation, then back-project the triangulations to 3D.

@jni jni added the bug Something isn't working label Apr 22, 2024
@imagesc-bot
Copy link

This issue has been mentioned on Image.sc Forum. There might be relevant details there:

https://forum.image.sc/t/high-quantities-of-extruded-polygons/95174/6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants