# SaveScreenshot very slow with opacity \< 1

**URL:** https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685
**Category:** ParaView Support
**Created:** [March 12, 2021, 1:28pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685 "2021-03-12T13:28:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![dax\_00](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dax_00/32/2786_2.png) [@dax\_00](https://discourse.paraview.org/u/dax_00)
#### Post date: [March 12, 2021, 1:28pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/1 "2021-03-12T13:28:23Z")

</div>

Dear All,

I wrote a script for postprocessing pressure data on surfaces.  
I noticed that when a geometry is plotted with opacity \< 1 the SaveScreenshot command takes very long (60 seconds vs 1 second if I set opacity to 1).

Is this supposed to happen?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [March 12, 2021, 1:36pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/2 "2021-03-12T13:36:21Z")

</div>

Do you have simple steps to reproduce ?

---

<div class="post-metadata">

### Author: ![dax\_00](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dax_00/32/2786_2.png) [@dax\_00](https://discourse.paraview.org/u/dax_00)
#### Post date: [March 12, 2021, 1:41pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/3 "2021-03-12T13:41:32Z")

</div>

Dear @mwestphal

my script loads a vtm that points to some vtp extracted in OpenFOAM. Then what follows is some filters to compute cell size, surface normals and merge of the dataset.

```
groupDatasets = XMLMultiBlockDataReader(FileName=['case.vtm'])
cellSize = CellSize(Input=groupDatasets)
generateSurfaceNormals = GenerateSurfaceNormals(Input=cellSize, ComputeCellNormals=1)
mergeBlocks = MergeBlocks(Input=generateSurfaceNormals)

```

Later the view is initialized and the geometry rendered:

```
view = GetActiveViewOrCreate('RenderView')
view.UseLight = 0

renderGeometry = Show(mergeBlocks, view)
renderGeometry.SetRepresentationType('Wireframe')
renderGeometry.AmbientColor = [0.0196078431372549, 0.027450980392156862, 0.03137254901960784]
renderGeometry.DiffuseColor = [0.0196078431372549, 0.027450980392156862, 0.03137254901960784]
renderGeometry.Opacity = 0.005

```

After this i do the screenshot of the view. If I comment the line containing “renderGeometry.Opacity”, the runtime is acceptable.

I am using PV 5.6.1.  
In addition to this, I am able to rendere the picture only using OSMesa

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [March 12, 2021, 2:55pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/4 "2021-03-12T14:55:27Z")

</div>

With translucent renders, we try to capture the translucency in the image (for PNG at least) by taking two renders, one with a white background and another with a black. There’s then some computation to determine what the translucency is for each V (from HSV) based on the difference between the two. If your scene takes a long time to render, that could be a contributing factor. Or that algorithm could need improvement (it was one of my first user-facing contributions to ParaView).

---

<div class="post-metadata">

### Author: ![dax\_00](https://discourse.paraview.org/user_avatar/discourse.paraview.org/dax_00/32/2786_2.png) [@dax\_00](https://discourse.paraview.org/u/dax_00)
#### Post date: [March 15, 2021, 11:01am UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/5 "2021-03-15T11:01:21Z")

</div>

Hi, @ben.boeckel  
what would you suggest to improve in the script? I do not understand how the savescreenshot command (not the Show command) could take this long. I do not see this large runtime if I save the view in the interactive GUI.

P.S. i checked the runtime of SaveScreenshot doing some profiling of the script

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [March 15, 2021, 3:01pm UTC](https://discourse.paraview.org/t/savescreenshot-very-slow-with-opacity-1/6685/6 "2021-03-15T15:01:21Z")

</div>

I think people are confusing different things here.

@ben.boeckel , what you’re referring to is saving PNG images with transparent background. That’s is different than simply saving images which include translucent geometry. If I am not mistaken, the latter is the case here.

@dax_00, are you using simply `pvpython` or is this using `pvbatch` and MPI to execute in parallel / distributed mode?

There might not much that can be done to speed up esp. since the rendering translucent geometry requires multiple passes and OSMesa may indeed be the bottleneck here. If you’re OSMesa build support `swr` using that as the GALLIUM\_DRIVER may be worth a shot. SWR renderer often is much faster than the default software renderer.

Secondly, splitting among multiple ranks instead of 1 may be worth a shot too. For that, I’d recommend using the latest version as the data redistribution code was revamped in 5.9 and will definitely be better than earlier versions. However, there are multiple things that come into play here e.g. cost of compositiing images, data redistribution etc. So it’s not a clear cut solution.
