Skip to content

Draw order combined with opacity does not behave as expected #1541

@kne42

Description

@kne42

Visual nodes drawn in front of others with sub-1 opacities set do not show the node underneath rendered.

Reproducible example:

#!/usr/bin/env python
from vispy import __version__, app, scene, use
from skimage import data


print('vispy version:', __version__)
use(app='PyQt5')

canvas = scene.SceneCanvas(show=True)
view = canvas.central_widget.add_view()
view.camera = scene.PanZoomCamera(aspect=1)
view.camera.flip = (0, 1, 0)

astro = scene.Image(data.astronaut(), parent=view.scene)
cam = scene.Image(data.camera(), parent=view.scene)

astro.order = 0
cam.order = -1  # will be displayed in front

# redraw the scenegraph
canvas._draw_order.clear()
canvas.update()

# offset to show that astro is really underneath cam
astro.transform = scene.STTransform(translate=(astro.size[0] / 2,
                                               astro.size[1] / 2))

# workaround since 'opacity' property does not function as intended
# fixed in development version of vispy
cam._opacity_filter.filter = (1, 1, 1, 0)  # 0 opacity

# set the view to show the images
view.camera.set_range((0, cam.size[0] + astro.size[0] / 2),
                      (0, cam.size[1] + astro.size[1] / 2))

# we expect to see the entirety of the astronaut here
app.run()
# we instead see the astronaut image with a corner cut out of it
# ie the camera image is still blocking light at 0 opacity

@AhmetCanSolak and I would be happy to fix this if you could give us some pointers.
cc @royerloic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions