Possible VTK 9.6.0rc2 regression with ghost cell rendering

ugrid.vtu (4.4 KB)

I have attached an UnstructuredGrid mesh file with a 'vtkGhostType' cell array. The top “row” of cells in the dataset are masked.

Using the code below with vtk==9.5.20250802.dev0, we get :

But with vtk==9.5.20250809.dev0, we get this instead, where the interface between the ghost cells and the rest of grid is no longer present, and we can see “inside” the mesh.

I tried looking at the diff Kitware/VTK@6ac70ce…5cda859 between the Aug 2 timestamp Kitware/VTK@6ac70ce and the aug 9 timestamp Kitware/VTK@5cda859 but nothing is jumping out in terms of changes to ghost cells affecting unstructured grids… Haven’t yet bisected to a specific commit.

Is this change intentional? Or is this a bug/regression with VTK 9.6?

import vtk

# Read VTU file
reader = vtk.vtkXMLUnstructuredGridReader()
reader.SetFileName('ugrid.vtu')
reader.Update()
data = reader.GetOutput()

# Mapper
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(data)

# Actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)

# Make grid white with black lines
prop = actor.GetProperty()
prop.EdgeVisibilityOn()
prop.SetEdgeColor(0.0, 0.0, 0.0)
prop.SetLineWidth(1.0)
prop.SetColor(1.0, 1.0, 1.0)
mapper.SetScalarVisibility(False)

# Renderer
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
renderer.SetBackground(0.1, 0.1, 0.1)

# Camera
camera = renderer.GetActiveCamera()
camera.SetPosition(1, 1, 1)
camera.SetViewUp(0, 0, 1)
renderer.ResetCamera()

# Render window
render_window = vtk.vtkRenderWindow()
render_window.AddRenderer(renderer)
render_window.SetSize(800, 600)

# Interactor
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(render_window)

# Start
render_window.Render()
interactor.Start()

Furthermore, this particular mesh can be converted to ExplicitStructuredGrid.

If we insert this code after reading the file:

alg = vtk.vtkUnstructuredGridToExplicitStructuredGrid()
alg.SetInputData(data)
alg.SetInputArrayToProcess(0, 0, 0, 1, 'BLOCK_I')
alg.SetInputArrayToProcess(1, 0, 0, 1, 'BLOCK_J')
alg.SetInputArrayToProcess(2, 0, 0, 1, 'BLOCK_K')
alg.Update()
data = alg.GetOutput()

And re-run the full example for both vtk versions mentioned above, we get the first image both times. This indicates that ghost cell rendering is now inconsistent across mesh types, and to me suggests that there is indeed a regression with how ghost cells are rendered for UnstructuredGrid types.

1 Like