# Volume rendering uniform grids

**URL:** https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988
**Category:** ParaView Support
**Created:** [April 7, 2020, 2:14pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988 "2020-04-07T14:14:34Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [April 7, 2020, 2:14pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/1 "2020-04-07T14:14:34Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/hwHL6WMKmlPrrlhzah9XCIWUmCD.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

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 7, 2020, 2:29pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/2 "2020-04-07T14:29:51Z")

</div>

> [@Andy\_Bauer](#):
>
> 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?

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 7, 2020, 5:36pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/3 "2020-04-07T17:36:27Z")

</div>

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.

---

<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: [April 7, 2020, 5:39pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/4 "2020-04-07T17:39:41Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [April 7, 2020, 8:26pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/5 "2020-04-07T20:26:08Z")

</div>

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

---

<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: [April 7, 2020, 9:48pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/6 "2020-04-07T21:48:08Z")

</div>

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.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/b/b5cbdaba790affc1ffbca6b394e46bb4644d487d.png)

---

<div class="post-metadata">

### Author: ![Sankhesh\_Jhaveri](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sankhesh_jhaveri/32/3374_2.png) [@Sankhesh\_Jhaveri](https://discourse.paraview.org/u/Sankhesh_Jhaveri)
#### Post date: [April 9, 2020, 12:36am UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/7 "2020-04-09T00:36:55Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [April 9, 2020, 3:27pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/8 "2020-04-09T15:27:31Z")

</div>

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](https://discourse.paraview.org/uploads/short-url/AnecgIBNtWSb3z3MfH7NKKdXTA3.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.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [April 9, 2020, 8:50pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/9 "2020-04-09T20:50:23Z")

</div>

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](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:

 ![hexes](https://discourse.paraview.org/uploads/default/original/2X/8/802aed2b80cbbeff10cda2deaefbc72825fe298c.png)

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

 ![tets](https://discourse.paraview.org/uploads/default/original/2X/d/d9c60cefd0c9a05a7943a0a7c2e4e26af91f7469.png)

The state files from master are:  
[resamplebugforhexes.pvsm](https://discourse.paraview.org/uploads/short-url/eQA9izFAH6N8lFhUq0mKk4ouEuu.pvsm) (501.1 KB) [resampleworkingfortets.pvsm](https://discourse.paraview.org/uploads/short-url/4xvReOgF6OiIcI6iTxvVxc3sltp.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.

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [April 9, 2020, 8:52pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/10 "2020-04-09T20:52:55Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Sankhesh\_Jhaveri](https://discourse.paraview.org/user_avatar/discourse.paraview.org/sankhesh_jhaveri/32/3374_2.png) [@Sankhesh\_Jhaveri](https://discourse.paraview.org/u/Sankhesh_Jhaveri)
#### Post date: [June 9, 2020, 4:24pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/11 "2020-06-09T16:24:12Z")

</div>

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/vtk/vtk/-/merge_requests/6976)  
[https://gitlab.kitware.com/paraview/paraview/-/merge\_requests/4179](https://gitlab.kitware.com/paraview/paraview/-/merge_requests/4179)

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

 ![VolumeWithBlanking](https://discourse.paraview.org/uploads/default/original/2X/e/eefd8bfdfa7f71a1149878bdd9a74c23a2755439.png)

Please take a look.

Thanks,  
Sankhesh

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [June 9, 2020, 6:12pm UTC](https://discourse.paraview.org/t/volume-rendering-uniform-grids/3988/12 "2020-06-09T18:12:42Z")

</div>

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