Volume rendering uniform grids

Hi,

Should volume rendering for vtkUniformGrid using blanking be supported in ParaView 5.8?

See the attached state file for PV 5.8 – uniformgrid_volumerender.pvsm (392.9 KB)

Basically, I thought that half of the volume would be transparent from the ImageData to UniformGrid filter but it’s fully viewable in the render view (take a slice of the output with a Y normal to see the blanked part of the uniform grid). I thought I heard about using separate fields for the color transfer function and opacity transfer function in ParaView but I couldn’t find that option. Does this functionality exist or was it just at the discussion stage?

I can probably get the effect I want with just playing around with the transfer function and using a Calculator filter to combine the blanking field and the pseudo-colored field (they’re both point data).

Thanks,
Andy

It is possible to do it, but it is not at all easy. Making it much simpler in the UI is slated for this year.

As for blanking, it doesn’t look to me like blanking is respected by any of the volume renderers for uniform grid data. I’ll check with the volume rendering experts to confirm.

I confirmed that the volume renderer ignores blanking/ghost cell flags, but it wouldn’t be too hard to add support for it. We may be able to do this when adding support for rectilinear grid volume rendering this year.

That’s curious. Ghost flags is indeed what’s relied on by volume rendering of unstructured grid datasets after applying resample to Image or Adaptive Resample to Image filters. Maybe the blanking for uniform grids is independent of the ghostcell logic and just needs to be consolidated.

@utkarsh.ayachit that’s great! Which volume renderer respects it?

nvm, doesn’t look like it does. It’s just relying on setting the scalar value to 0 which generally is the opacity-0 value as well.

In general, the volume mappers do no support ghost information. Adding support for ghost cells to the GPU volume mapper should not be a difficult task, though.

1 Like

Looking at this a bit more, the vtkGhostType cell data array that comes out of ResampleToImage is incorrect. See the attached state file for PV 5.8. resamplecellghostbug.pvsm (681.5 KB)

Here, I create a source and then clip at an odd angle so that the Resample to Image filter should want to label some ghost stuff. Then I copy the cell blanking array using the Calculator filter and remove the blanking arrays using the Pass Arrays filter to make sure that I can see the actual cell blanking array produced by the Resample to Image filter. Finally, to make sure I’m not seeing surface effects, I use the VOI filter to remove a couple of outer layer cells.

Basically, ResampleToImage is using the vtkGhostType point data array values as the same values for the cell data array. So the next question is, what’s the correct way to compute cell blanking for this filter? At this point I can potentially see two ways:

  1. A cell is blanked if any of its points are blanked.
  2. A cell is blanked if all of its points are blanked.

In my opinion this should be a filter option for the user to decide with #2 as the default.

I’m starting to think that there’s a bug in the Resample to Image filter for the cells that are produced from the output of the Clip filter. I tried to look at them with the 'Validate Cells` filter but that also seems a bit buggy for hex cells (see https://gitlab.kitware.com/vtk/vtk/-/issues/17841).

Any way, looking at the vtkValidPointMask array output from Resample to Image filter for hexes it looks like:

If I change the Unstructured Cell Types source to output tets instead it, everything looks correct to me:

The state files from master are:
resamplebugforhexes.pvsm (501.1 KB) resampleworkingfortets.pvsm (501.1 KB)

I think the vtkGhostType information that’s computed is correct, based on getting correct vtkValidPointMask information.

This issue though is still orthogonal to properly blanking vtkImageData ghost information during volume rendering. Maybe the output of the Resample to Image filter really should be a vtkUniformGrid instead.

@utkarsh.ayachit Would this possibly impact Stefan? He will frequently use the clip to scalar filter, then resample to image…

Hi Andy,

The following merge requests add volume blanking support for uniform grids in VTK and ParaView:

https://gitlab.kitware.com/vtk/vtk/-/merge_requests/6976
https://gitlab.kitware.com/paraview/paraview/-/merge_requests/4179

The output of the state file you shared with these changes:

Please take a look.

Thanks,
Sankhesh

Ok, checked out both ParaView and VTK individually and this does indeed look correct to me as well.