# How to render two volumes in the 3D scene at the same time?

**URL:** <https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680>\
**Category:** Development\
**Created:** [December 18, 2017, 6:13am UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680 "2017-12-18T06:13:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wpgao](https://avatars.discourse-cdn.com/v4/letter/w/8e8cbc/32.png) [@wpgao](https://discourse.slicer.org/u/wpgao)\
**Post date:** [December 18, 2017, 6:13am UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/1 "2017-12-18T06:13:11Z")

</div>

Hi everybody,

Is there anyway to render two volumes (for example, CT and MR volumes) in the 3D scene at the same time using volume rendering? Thanks!

---

<div class="post-metadata">

**Author:** ![timeanddoctor](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/timeanddoctor/32/5839_2.png) [@timeanddoctor](https://discourse.slicer.org/u/timeanddoctor)\
**Post date:** [December 18, 2017, 6:47am UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/2 "2017-12-18T06:47:48Z")

</div>

in my opinion there are still no module could achieve that goal

---

<div class="post-metadata">

**Author:** ![pieper](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/pieper/32/8_2.png) [@pieper](https://discourse.slicer.org/u/pieper)\
**Post date:** [December 18, 2017, 12:32pm UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/3 "2017-12-18T12:32:35Z")

</div>

Right - currently only one volume at a time can be volume rendered, but there are some new developments underway that should support multiple volume rendering in the future.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 18, 2017, 1:52pm UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/4 "2017-12-18T13:52:37Z")

</div>

Here is the pull request of multi-volume rendering in VTK:

> **[Support overlapping volumes through multiple inputs in GPUVolumeMapper (!3699)...](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/3699)**
>
> When multiple inputs are rendered through the same mapper, it is possible to composite the overlapping areas correctly. Inputs are connected directly to the mapper and its parameters...

It’ll probably take a few months (depending on how urgently a specific project needs this) to get it integrated into Slicer.

Note that multi-volume rendering is only useful in very specific cases, i.e., when displayedstructures just barely overlap. In general, you still need to segment your volumes before visualization, so don’t expect any radical change in processing & visualization workflow - just more colorful images and structures with smoother-looking boundaries.

---

<div class="post-metadata">

**Author:** ![muratmaga](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/muratmaga/32/3622_2.png) [@muratmaga](https://discourse.slicer.org/u/muratmaga)\
**Post date:** [December 18, 2017, 7:50pm UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/5 "2017-12-18T19:50:21Z")

</div>

Just to clarify. If you don’t need them to be superimposed in the same rendering window, you can choose switch to dual 3D layout, assign each volume to a different viewport, adjust their volume properties and finally link cameras.

That way you can see both MR and CT in 3D scene at the same time, just not as superimposed volumes.

---

<div class="post-metadata">

**Author:** ![wpgao](https://avatars.discourse-cdn.com/v4/letter/w/8e8cbc/32.png) [@wpgao](https://discourse.slicer.org/u/wpgao)\
**Post date:** [April 21, 2018, 9:58am UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/6 "2018-04-21T09:58:09Z")

</div>

> [@muratmaga](#):
>
> e properties and

it’s a good idea, thanks!

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 21, 2018, 1:33pm UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/7 "2018-04-21T13:33:40Z")

</div>

@cpinter is working on adding rendering of multiple volumes. In the latest nightly, you can already show multiple volumes using 3D volume rendering (raycasting). The limitation is that only non-overlapping volumes are displayed correctly.

Soon @cpinter will integrate his latest enhancements that allow correct rendering of overlapping volumes (using VTK’s multi-volume GPU renderer).

---

<div class="post-metadata">

**Author:** ![cpinter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/cpinter/32/7995_2.png) [@cpinter](https://discourse.slicer.org/u/cpinter)\
**Post date:** [April 21, 2018, 2:01pm UTC](https://discourse.slicer.org/t/how-to-render-two-volumes-in-the-3d-scene-at-the-same-time/1680/8 "2018-04-21T14:01:30Z")

</div>

Indeed. Just to keep expectations in bay, VTK’s multi-volume renderer has issues, such as lack of shading support and significantly lower performance than the current GPU renderer. I’ll follow up with VTK developers about these and see if something can be done in reasonable time. This should be available in Slicer core sometime next week.

@wpgao Since the integration of multi-volume support in volume rendering that happened this week, it is now possible to do what @muratmaga suggested. You can show multiple volumes and turn on only one view for each.
