# Transparency in vtkPolyData (actor, RGBA) results in invisible renderings in Qt app (VTK 8.1.2)

**URL:** https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424
**Category:** Development
**Created:** [January 14, 2020, 9:00pm UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424 "2020-01-14T21:00:18Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sophonet](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@Sophonet](https://discourse.vtk.org/u/Sophonet)
#### Post date: [January 14, 2020, 9:00pm UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424/1 "2020-01-14T21:00:18Z")

</div>

Hi VTK team,

using VTK 8.1.2 and Qt 5.14 (or earlier versions?), rendering semi-transparent meshes seems to be an issue…

- When adding an RGBA cell array with transparency to our PolyData object or (alternatively) setting the actor’s opacity to something not equal to 1.0, in our Qt demo app, the PolyData object (Mesh) does not show up at all. With an opacity of 1.0, the mesh is displayed correctly (but without transparency)

- I have tried approaching this problem according to

[https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk](https://stackoverflow.com/questions/47528086/problems-with-rendering-transparent-objects-in-vtk) and

[http://vtk.1045678.n5.nabble.com/Strange-Visualization-Results-With-Transparency-on-Polydata-td5749377.html](http://vtk.1045678.n5.nabble.com/Strange-Visualization-Results-With-Transparency-on-Polydata-td5749377.html)

without success. In the latter case (no Qt), I could solve the visualization issue with the recommended call to **ren.SetUseDepthPeeling(True)**, results show up as expected, but in our Qt app, meshes still get invisible after that call.

I have once tried VTK 8.2.0, but this has introduced other problems in the Qt application due to some strange event errors, making our demonstrator unusable (similar to [https://gitlab.kitware.com/vtk/vtk/issues/17572](https://gitlab.kitware.com/vtk/vtk/issues/17572)).

Any advise on how to display semi-transparent PolyData in a Qt application? What Qt and VTK version should we use?

Best,

```
Sophonet
```

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 14, 2020, 10:22pm UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424/2 "2020-01-14T22:22:50Z")

</div>

Have you tried to use OpenGL compatibility profile on Windows?

---

<div class="post-metadata">

### Author: ![Sophonet](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@Sophonet](https://discourse.vtk.org/u/Sophonet)
#### Post date: [January 15, 2020, 7:31am UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424/3 "2020-01-15T07:31:09Z")

</div>

Thanks - in my main(), before QApplication, I have this:

auto defaultFormat = QVTKOpenGLWidget::defaultFormat();

// Next two lines also do not make a difference  
defaultFormat.setProfile(QSurfaceFormat::CompatibilityProfile);  
vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0);

QSurfaceFormat::setDefaultFormat(defaultFormat);

with the same effect, i.e. the problem still exists. Any more/other ideas?

---

<div class="post-metadata">

### Author: ![lassoan](https://discourse.vtk.org/user_avatar/discourse.vtk.org/lassoan/32/50_2.png) [@lassoan](https://discourse.vtk.org/u/lassoan)
#### Post date: [January 15, 2020, 12:57pm UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424/4 "2020-01-15T12:57:57Z")

</div>

Test with with 8.2 and latest VTK master, too.

---

<div class="post-metadata">

### Author: ![Sophonet](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/s/ecccb3/32.png) [@Sophonet](https://discourse.vtk.org/u/Sophonet)
#### Post date: [January 20, 2020, 9:48am UTC](https://discourse.vtk.org/t/transparency-in-vtkpolydata-actor-rgba-results-in-invisible-renderings-in-qt-app-vtk-8-1-2/2424/5 "2020-01-20T09:48:27Z")

</div>

As mentioned earlier, I could not try with VTK 8.2, since there was some bug with respect to Qt/VTK. I retried it now (with qt 5.14.0), and the problem is still there, when destroying and creating new QVTKOpenGLWidget instances, the application crashes.

I have now tried VTK master, and there, things work, no crash and no transparency problem. Thanks.

Any idea when there will be a new official release including the latest changes?

Best, sophonet
