# How to render a model with material and data(volume render) at the same time

**URL:** https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725
**Category:** ParaView Support
**Tags:** vtk
**Created:** [March 28, 2023, 7:56am UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725 "2023-03-28T07:56:09Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 28, 2023, 7:56am UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/1 "2023-03-28T07:56:09Z")

</div>

I have a model and the power distribution of this model as follow:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/b/bf99526ef09a55f200ed3b0606459cd9baa2e676.png)  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/d/df8996e6985f4618916d0d6e02b04cdfab3a95d2.png)  
I want to give the model a material to make this model real, and I want to see the data with volume rendering at the same time.  
I use the Material Editor to attach a material to the model, but when I take on the OSPRay to render the model, the volume data will disappear.  
Is there any other way to solve this problem?  
I am a new user, I’m desperate for someone to help me answer this question. Thanks vety much!

---

<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: [March 28, 2023, 10:13am UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/2 "2023-03-28T10:13:03Z")

</div>

Please share your `test.vtk`

Best,

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 12:09pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/3 "2023-03-29T12:09:08Z")

</div>

[test.vtk](https://discourse.paraview.org/uploads/short-url/4dpM0JPZkjDVCt7q0V7V2See5on.vtk) (1.8 KB)  
this is my test.vtk file. The model is a 3.1\*3.1 cube, its center coordinate is (1.5,1.5,1.5).

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 12:09pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/4 "2023-03-29T12:09:52Z")

</div>

this is my test.vtk file. The model is a 3.1\*3.1 cube, its center coordinate is (1.5,1.5,1.5).  
[test.vtk](https://discourse.paraview.org/uploads/short-url/4dpM0JPZkjDVCt7q0V7V2See5on.vtk) (1.8 KB)

---

<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: [March 29, 2023, 1:02pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/5 "2023-03-29T13:02:26Z")

</div>

For some reasons your dataset appears almost transparent when using volume rendering with ospray:

![image](https://discourse.paraview.org/uploads/default/original/2X/3/30e379519a6734c6cba7d265ef45eb4718957942.png)

I’m not sure why, maybe because there are not a lot of cells ?

@Dave_DeMarle

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 1:19pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/6 "2023-03-29T13:19:11Z")

</div>

Thanks for your reply. I have tried other models and VTK files whose number of cells is sufficient. However, they also experience the same problem as the test.vtk file.

---

<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: [March 29, 2023, 1:25pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/7 "2023-03-29T13:25:55Z")

</div>

Could you share such files ? I only reproduce with your example so far. Here is how a classic unstrectured wavelet looks like:

![image](https://discourse.paraview.org/uploads/default/original/2X/9/9cf6e20cd6b19bfd3f9a30ba9ac206914bd50d40.png)  
[wavelet.vtk](https://discourse.paraview.org/uploads/short-url/qjl5guLXED9Fz1UQ087w7drMdJn.vtk) (2.6 MB)

---

<div class="post-metadata">

### Author: ![Kenneth\_Moreland](https://discourse.paraview.org/user_avatar/discourse.paraview.org/kenneth_moreland/32/15033_2.png) [@Kenneth\_Moreland](https://discourse.paraview.org/u/Kenneth_Moreland)
#### Post date: [March 29, 2023, 1:59pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/8 "2023-03-29T13:59:32Z")

</div>

It looks like when ParaView uses the projected tetrahedra method for volume rendering (the default for unstructured data like [test.vtk](https://discourse.paraview.org/uploads/short-url/4dpM0JPZkjDVCt7q0V7V2See5on.vtk)) the OSPray render is rendering the volume much more transparent than OpenGL. I don’t know why, but there are a couple things you can do to correct it.

One thing you can do is to change the volume rendering mapper from `Projected tetrahedra` to `Resample To Image`. The image volume rendering seems equivalent between OSPray and OpenGL. You may have to play with the sampling dimensions to get a good image.

 ![Screen Shot 2023-03-29 at 7.42.56 AM](https://discourse.paraview.org/uploads/default/original/2X/6/6bce6a09e850b13da3f9abf7e2e8f76a2ae3b57e.png)

If you need the details of the unstructured grid and must render it directly, you can alternately lower the `Scalar Opacity Unit Distance` parameter. (I don’t know why OSPray is interpreting this parameter differently than OpenGL. This might be related to [bug #18890](https://gitlab.kitware.com/paraview/paraview/-/issues/18890), but I’m not sure.) If you crank that value down to 0.1, I can see the middle (opaque) part of the volume clearly. That said, the results look very speckled. OSPRay must be using some kind of trapdoor transparency for rendering. You can correct that by increasing the `Progressive Passes` and/or `Samples Per Pixel` parameters for OSPRay. That will increase the rendering time though.

 ![Screen Shot 2023-03-29 at 7.58.23 AM](https://discourse.paraview.org/uploads/default/original/2X/5/54e02ab6eadcaeb2df289ab62816f6cf8b210563.png)

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 2:07pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/9 "2023-03-29T14:07:25Z")

</div>

Taking the “wavelet.vtk” file as an example, I imported it into ParaView and used volume rendering to display the data, while also using OSPRay. I found that when using OSPRay, the volume rendering data in the “wavelet.vtk” file was still visible, but when using my VTK file, the volume rendering data disappeared. I am puzzled by this phenomenon.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/7/7ddb35b3dff1d4423d60e299b948e1b8b8ef81c1.jpeg)  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/a/a77bb25c29db3c88577eacf116ef73bd3b23e896.png)  
here is my file:  
I’m sorry that I failed to upload my file(23068KB). Because it’s huge?

---

<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: [March 29, 2023, 2:11pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/10 "2023-03-29T14:11:25Z")

</div>

> I’m sorry that I failed to upload my file(23068KB). Because it’s huge?

No need imo.

> It looks like when ParaView uses the projected tetrahedra method for volume rendering (the default for unstructured data like test.vtk) the OSPray render is rendering the volume much more transparent than OpenGL. I don’t know why, but there are a couple things you can do to correct it.

I agree @Kenneth_Moreland . I think opening an issue is in order: [https://gitlab.kitware.com/paraview/paraview/-/issues](https://gitlab.kitware.com/paraview/paraview/-/issues)

Could you take care of it @zjqf ?

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 2:11pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/11 "2023-03-29T14:11:27Z")

</div>

thanks for your reply. I have tried the ‘Resample To Image’, and I will try the second way. Thanks very much!

---

<div class="post-metadata">

### Author: ![zjqf](https://discourse.paraview.org/user_avatar/discourse.paraview.org/zjqf/32/11119_2.png) [@zjqf](https://discourse.paraview.org/u/zjqf)
#### Post date: [March 29, 2023, 2:12pm UTC](https://discourse.paraview.org/t/how-to-render-a-model-with-material-and-data-volume-render-at-the-same-time/11725/12 "2023-03-29T14:12:53Z")

</div>

Ok! Thank you very much!
