Opacity problem for selected scalar range

Hi All

I’m using vtkDiscretizableColorTransferFunction to set opacity for selected scalar range in unstructured grid.
Depending of the camera position displayed unstructured grid shows some strange artifacts.
As you can see in attached image 1, from that angle it looks OK, but in images 2 and 3 parts of the same grid disappear. I tried to use different filters, vtkDataSetSurfaceFilter,vtkGeometryFilter etc, enabled deep peeling all the same.
Can you please give me idea where to look, I’m using Activiz VTK version 6.3 if that helps.

Thanks
MK

Hello, Markara,

I’ve also recently had those artifacts with translucent elements. Here’s what I did to render them properly (C++):

    // Prepare to render transparency/translucency adequately
    _renderer->SetUseDepthPeeling(1);
    _renderer->SetOcclusionRatio(0.1);
    _renderer->SetMaximumNumberOfPeels(4);
    _vtkwidget->GetRenderWindow()->SetMultiSamples(0);
    _vtkwidget->GetRenderWindow()->SetAlphaBitPlanes(1);

The calls above should be added to the part of your code that is configuring the VTK widget, renderer, etc. You can experiment with the values above to different ones that suit you.

regards,

Paulo

Hi Paulo
I have identical parameters in my settings. Only issue is that I can see for now is that i’m testing this on my laptop which doesn’t have dedicated graphic cart and remote desktop, (working from home, damn COVID) and that could be an issue, but i’m not sure

Thanks for you response

It surprises me that it even works remotely. So I guess it is not a VTK issue, then. I’d contact the technical support of whichever virtualization software you’re using to get a configuration that results in good OpenGL rendering. Maybe some OpenGL features are disabled by default. Maybe it’s using software emulation. Who knows…

I’m developer of the software and previously didn’t use vtkDiscretizableColorTransferFunction but just regular vtkColorTransferFunction and was hoping to include transparency in new version. I will go in next couple days to the office and check it on my desktop, but I have a feeling that deep peeling is not an issue. I imported the same grid into ParaView and even there wasn’t perfect although wasn’t the same as in images I attached.

It’s not only deep peeling. It’s a combination of parameters! Did you to check the other 4 parameters as shown in the code I posted?

Yes, I have identical parameters. I checked even on my laptop if deep peeling was used using function
CurrentRenderer.GetLastRenderingUsedDepthPeeling() and returned value was 1.
I used the same grid in Paraview, eve there are some artifact depending of the angle, but much less compared to my application.

Paraview

You said that you are using Activiz VTK version 6.3. Does that mean VTK 6.3? If so, I strongly recommend upgrading to a recent version (8 or 9).

I’m not sure that’ll help, again, even Paraview with I guess VTK version 8 has the same problem

Can you share the dataset that shows this problem?

BQUGHENTGZ.vtu (82.8 KB)
Yes, here it is

Test.pvsm (262.9 KB)
And her is the PVSM file

Hi Cory I found another issue. If I have negative scalars opacity is not working at all not in my application nor in Paraview. Not sure if there is way around, but I couldn’t find it.
Please see attached image and paraview file.
Thank you for looking

OpacityWitNegScalats.pvsm (226.8 KB)
HMVLXKNXET.vtu (14.1 KB)

Hi @MarKara. Closing the loop on this: the issue with negative scalars should be resolved in VTK 9.1 and ParaView 5.10.

Thanks Cory