# How to convert a surface mesh to voxels?

**URL:** https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876
**Category:** ParaView Support
**Created:** [February 2, 2022, 4:58am UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876 "2022-02-02T04:58:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [February 2, 2022, 4:58am UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876/1 "2022-02-02T04:58:26Z")

</div>

Hi

I have a surface mesh file (.stl) and I was wondering if there exists a filter in Paraview to convert it to volumetric voxels and visualize it?

Thanks,  
Yang

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 2, 2022, 8:38am UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876/2 "2022-02-02T08:38:48Z")

</div>

Could you give some details on the expected results ?

---

<div class="post-metadata">

### Author: ![Cam](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cam/32/8343_2.png) [@Cam](https://discourse.paraview.org/u/Cam)
#### Post date: [February 2, 2022, 4:43pm UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876/3 "2022-02-02T16:43:17Z")

</div>

I would like to convert a closed surface mesh (.stl) to vtkImageData or unstructuregrid to have volume rendering, i.e., the inside of surface mesh is rendered as voxels. I am currently looking into implicit model. What is the general approach to solve this problem?

---

<div class="post-metadata">

### Author: ![Matheus\_Viana](https://discourse.paraview.org/user_avatar/discourse.paraview.org/matheus_viana/32/8428_2.png) [@Matheus\_Viana](https://discourse.paraview.org/u/Matheus_Viana)
#### Post date: [February 2, 2022, 7:06pm UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876/4 "2022-02-02T19:06:48Z")

</div>

This can be done in VTK with vtkPolyDataToImageStencil. Maybe in paraview you can use a programmable filter to implement vtkPolyDataToImageStencil?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 3, 2022, 9:56am UTC](https://discourse.paraview.org/t/how-to-convert-a-surface-mesh-to-voxels/8876/5 "2022-02-03T09:56:07Z")

</div>

What data do you expect inside the volume ? There will be none.

In any case, to get a vtkImageData use GaussianRessampling, to get a vtkUnstructuredGrid use Delaunay3D.
