anti-alias seems not working in QVTKOpenGLNativeWidget

The left window is a QVTKOpenGLNativeWidget renderwindow, the right is vtkRenderWindow.
The gree cube is a vtkCubeSource → vtkGlyph3DMapper. You can see the cube in right window is smoother than left.

I have write the following code, but it didn’t work.

    vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(16);
    QSurfaceFormat::setDefaultFormat(QVTKOpenGLNativeWidget::defaultFormat());
    // vtkwidget is a instance of QVTKOpenGLNativeWidget
    ui->vtkwidget->GetRenderWindow()->SetMultiSamples(16);

Hello,

Do make sure you call these:

BEFORE instantiating a QVTKOpenGLNativeWidget.

take care,

PC

1 Like

Hi Paulo, I have done this as you did, but the problem still exist. (I think the problem is caused by other reason, may not anti-alias)

Please see the image blow

cube 1 is vtkCubeSource->vtkPolyDataMapper->vtkActor. Cube1’s opacity = 1

cube 2~6 are vtkCubeSource->vtkGlyph3DMapper->vtkActor ( In vtkGlyph3DMapper, I have set difference scale and orientation for each cube), cube 2~6 's opcaity = 0.5

Why cube 2~6 look like so bad? Do you have any idea?

Hello,

Can you try FXAA? FXAA is post-rendering, thus it can mitigate certain aliasing caused by some shaders MSAA is unable to handle. Maybe such shaders are involved in the case of the cubes 2-6. Either this or change the pink rectangles pipeline to that of the green one. BTW, why do you need vtkGlyph3DMapper instead of a common polydata mapper?

take care,

PC

Hi, I have tried FXAA, the result is not so good I think. The reason why I use vtkGlyph3DMapper is because I need to render thousands of cubes / arrow / sphere / or other source at 30fps. And those object s are changing all the time (color / size / pos / orientation).

BTW, I found why I can see edges in cube 2~6. Because they are transparent. I think I found a strange behaviour that vtk have. You can look at this link object seems wrong rendered when transparency are used - Support - VTK