# Dealing with 3D volumes and RenderTargetTexture

**URL:** <https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369>\
**Category:** Questions\
**Created:** [March 26, 2023, 6:16pm UTC](https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369 "2023-03-26T18:16:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amr-zayed](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/amr-zayed/32/27358_2.png) [@amr-zayed](https://forum.babylonjs.com/u/amr-zayed)\
**Post date:** [March 26, 2023, 6:16pm UTC](https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369/1 "2023-03-26T18:16:50Z")

</div>

I’ve reached a brick wall here!

I want to apply a custom filter on a 3D volume once and then use the processed 3D volume in another shader where I do more processing. I figured out that this can be done using RenderTargetTexture but there is something quite wrong.

Here is a playground to illustrate what I’m trying to do: [https://playground.babylonjs.com/#FQVG2V#12](https://playground.babylonjs.com/#FQVG2V#12)

Note: the first shader is not exactly what I have, I just want to know how to pass a filtered volume to another shader correctly

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 26, 2023, 8:53pm UTC](https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369/2 "2023-03-26T20:53:07Z")

</div>

`RenderTargetTexture` does not support rendering to a 3D texture, only to a single, a 2DArray or a cube texture: the `layers` parameter is for the number of textures in the 2DArray.

The [MultiRenderTarget extended support](https://github.com/BabylonJS/Babylon.js/pull/13435) PR adds support for rendering to multiple slices of a 2DArray or of a 3D texture at once: you have to bind the slice(s) of the 2DArray/3D texture you want to render to, you can’t render to the whole 2DArray / 3D texture. However, rendering to a slice of a 3D texture is currently bugged in Angle (so, in Chrome, Firefox and Safari at least), and it does not work except if you choose OpenGL as the backend, which is not the default setting.

---

<div class="post-metadata">

**Author:** ![amr-zayed](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/amr-zayed/32/27358_2.png) [@amr-zayed](https://forum.babylonjs.com/u/amr-zayed)\
**Post date:** [March 26, 2023, 11:35pm UTC](https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369/3 "2023-03-26T23:35:09Z")

</div>

To ensure I understand, I have to replace the `RenderTargetTexture` obj with a `MultiRenderTarget` obj and then adjust the settings for that. Finally, I can use the `MultiRenderTarget` obj as the `sampler3D` texture for the second shader. Is that right?

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [March 27, 2023, 8:56am UTC](https://forum.babylonjs.com/t/dealing-with-3d-volumes-and-rendertargettexture/39369/4 "2023-03-27T08:56:18Z")

</div>

Here’s a PG that should explain how to use the new feature, but that will work only after the PR is merged:

> **[Babylon.js Playground](https://playground.babylonjs.com/#XSNYAU%231)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes
