# Generate a 3D Texture

**URL:** <https://forum.babylonjs.com/t/generate-a-3d-texture/1678>\
**Category:** Questions\
**Created:** [March 1, 2019, 9:50pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678 "2019-03-01T21:50:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [March 1, 2019, 9:50pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/1 "2019-03-01T21:50:47Z")

</div>

What would be the best method to create a 3d texture with like lets say a solid black and white gradient in the Y Axis so if you were to just display it would like like this:  
 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/8/8e42f8538fcf7b0d34537cbbdfb30d30917a1fea.png)

And then the second part of the question is I know I can get a image passed back from the GPU when its 2d, as a renderTarget, but what about a 3d, I kinda feel like that might not be possible and if its not then I will have to look at doing a flipbook setup for simulations…

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 1, 2019, 10:02pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/2 "2019-03-01T22:02:56Z")

</div>

I would recommend using RawTexture3d that you can fill with the data you want:  
[https://doc.babylonjs.com/api/classes/babylon.rawtexture3d](https://doc.babylonjs.com/api/classes/babylon.rawtexture3d)

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [March 1, 2019, 10:08pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/3 "2019-03-01T22:08:15Z")

</div>

Is it possible to have the GPU create a 3d texture in a similar manner as a rtt?

I’m trying to do simulations on the GPU with 3d volume maps, but I’m not sure how to ping-pong the data when its a 3d texture.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 1, 2019, 10:35pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/4 "2019-03-01T22:35:56Z")

</div>

so far this is not something we do. you can render to multiple textures but not to a texture3D

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 1, 2019, 10:36pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/5 "2019-03-01T22:36:07Z")

</div>

But that could be nice to add 😉

---

<div class="post-metadata">

**Author:** ![Pryme8](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/pryme8/32/7212_2.png) [@Pryme8](https://forum.babylonjs.com/u/Pryme8)\
**Post date:** [March 1, 2019, 10:39pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/6 "2019-03-01T22:39:04Z")

</div>

is it technically possible?

Ill hope on some research here, cause if its possible lets mock up a GOL simulation as a 3d volume.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [March 1, 2019, 10:40pm UTC](https://forum.babylonjs.com/t/generate-a-3d-texture/1678/7 "2019-03-01T22:40:59Z")

</div>

I don’t think so but it is worth checking:)
