# Qt5 branch - MacOS transparency issue

**URL:** <https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961>\
**Category:** Development\
**Tags:** qt\
**Created:** [August 28, 2017, 5:43pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961 "2017-08-28T17:43:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [August 28, 2017, 5:43pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/1 "2017-08-28T17:43:45Z")

</div>

Built MacOS 10.12.6 off fresh support-qt5-2017-08-11-r26241 branch. Built fine, runs fine (overall).

Graphics card is AMD Radeon R9 M370 on MacBook Pro Retina 15" on external thunderbolt display.

When displaying 3D model (from “Create surface”), there are transparency artifacts when displaying surfaces with 0.5 opacity. Should this be working properly with OpenGL 2 and VTK 8?

I can provide a video of the issue if needed.

Thanks!

-Hollister

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 28, 2017, 6:43pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/2 "2017-08-28T18:43:58Z")

</div>

To get correct transparency, you need to enable depth peeling in menu: Edit / Application settings / Views / 3D viewer defaults / Use depth peeling - then restart Slicer.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 28, 2017, 7:20pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/3 "2017-08-28T19:20:23Z")

</div>

> [@lassoan](#):
>
> Edit / Application settings / Views / 3D viewer defaults / Use depth peeling

While it can impact performances in some scenario, I wonder if we should enable `depth peeling` by default …

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 28, 2017, 8:27pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/4 "2017-08-28T20:27:09Z")

</div>

Yes, we should enable it by default when we switch to the OpenGL2 backend.

The performance decrease with the OpenGL backend was significant and at some point the feature stopped working (at least on Windows), so it made no sense to enable it by default for the old backend.

---

<div class="post-metadata">

**Author:** ![hherhold](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/hherhold/32/12199_2.png) [@hherhold](https://discourse.slicer.org/u/hherhold)\
**Post date:** [August 29, 2017, 11:34am UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/5 "2017-08-29T11:34:51Z")

</div>

Issue still occurs with depth peeling activated. (Same as recent nightly build, incidentally.)

Is the Qt5 branch set to use OpenGL 2 by default? Slicer\_VTK\_RENDERING\_BACKEND is set to OpenGL2, I’d been assuming that was all I needed to do. Qt version is 5.9.1.

Let me know if you want a video of the issue.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [August 30, 2017, 3:18am UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/6 "2017-08-30T03:18:08Z")

</div>

I’ve just tried and for me, enabling depth peeling fixes transparent polygon rendering (Windows, OpenGL2 backend, Qt 5.6). Note that you have to rebuild VTK from scratch if you switch to another rendering backend - a forced rebuild may not be enough.

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [August 31, 2017, 9:17pm UTC](https://discourse.slicer.org/t/qt5-branch-macos-transparency-issue/961/7 "2017-08-31T21:17:00Z")

</div>

> [@hherhold](#):
>
> Is the Qt5 branch set to use OpenGL 2 by default?

The version of VTK will default to 8 if `Qt5_DIR` is used to configure Slicer.

That said, if you set `Qt5_DIR` in an already configured build tree … it will not force the version of VTK.

[https://github.com/Slicer/Slicer/blob/ee5c8703642cf8f42e9594bc780cb0801623b39d/CMakeLists.txt#L310-L319](https://github.com/Slicer/Slicer/blob/ee5c8703642cf8f42e9594bc780cb0801623b39d/CMakeLists.txt#L310-L319)

[https://github.com/Slicer/Slicer/blob/ee5c8703642cf8f42e9594bc780cb0801623b39d/CMakeLists.txt#L546-L553](https://github.com/Slicer/Slicer/blob/ee5c8703642cf8f42e9594bc780cb0801623b39d/CMakeLists.txt#L546-L553)
