glue-viz / glue-vispy-viewers

3-d data viewers for glue based on VisPy
http://glueviz.org/en/stable/whatsnew/experimental_3d.html#experimental-3d
BSD 2-Clause "Simplified" License
25 stars 21 forks source link

3D renderings fail with vispy 0.9.0 #368

Closed e-koch closed 2 years ago

e-koch commented 2 years ago

Describe the bug Upgrading my environment led to the new vispy v0.9.0 being installed. This causes the following error when rendering a spectral-line data cube:

Traceback (most recent call last):
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/app/qt/mdi_area.py", line 63, in dropEvent
    new_layer(layer)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/app/qt/mdi_area.py", line 54, in new_layer
    application.choose_new_data_viewer(layer)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/app/qt/application.py", line 1009, in choose_new_data_viewer
    return self.do(cmd)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/core/application_base.py", line 258, in do
    return self._cmds.do(command)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/core/command.py", line 125, in do
    result = cmd.do(self._session)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/core/command.py", line 215, in do
    viewer = session.application.new_data_viewer(self.viewer, self.data)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/utils/matplotlib.py", line 170, in wrapper
    result = func(*args, **kwargs)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/app/qt/application.py", line 1013, in new_data_viewer
    viewer = super(GlueApplication, self).new_data_viewer(viewer_class, data=data, state=state)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/core/application_base.py", line 82, in new_data_viewer
    c = viewer_class(self._session)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue/viewers/common/qt/data_viewer.py", line 27, in __call__
    obj = type.__call__(cls, *args, **kwargs)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue_vispy_viewers/volume/volume_viewer.py", line 78, in __init__
    multivol = MultiVolume(emulate_texture=emulate_texture,
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/vispy/scene/visuals.py", line 127, in __init__
    subclass.__init__(self, *args, **kwargs)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/glue_vispy_viewers/volume/volume_visual.py", line 91, in __init__
    Visual.__init__(self, vcode=VERT_SHADER, fcode="")
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/vispy/visuals/visual.py", line 341, in __init__
    self._prepare_transforms(self)
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/vispy/visuals/volume.py", line 1160, in _prepare_transforms
    view.view_program.frag['viewtransformf'] = view_tr_f
  File "/Users/ekoch/anaconda3/envs/glueenv/lib/python3.8/site-packages/vispy/visuals/shaders/function.py", line 216, in __setitem__
    raise KeyError('Invalid template variable %r' % key)
KeyError: "Invalid template variable 'viewtransformf'"

Downgrading to vispy v0.8.1 fixed this issue.

To Reproduce Select "3D volume render" from a spectral-line data cube. Mine was written out from a CASA image, but the behaviour seems the same for a few different cubes I tried.

Details:

astrofrog commented 2 years ago

@e-koch - can you confirm if this is fixed with glue-vispy-viewers v1.0.4?

e-koch commented 2 years ago

@astrofrog -- Yes, it's fixed. thanks!