# Volumetric Rendering with shader and 2D Textures - multi pass

**URL:** <https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966>\
**Category:** Questions\
**Created:** [October 16, 2020, 12:15pm UTC](https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966 "2020-10-16T12:15:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxOSchulte](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@MaxOSchulte](https://forum.babylonjs.com/u/MaxOSchulte)\
**Post date:** [October 16, 2020, 12:15pm UTC](https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966/1 "2020-10-16T12:15:10Z")

</div>

Hello together 🙂

i’m trying to implement volumetric rendering with babylonjs.

I’m following this tutorial [http://www.lebarba.com](http://www.lebarba.com) and i’m using this github project as a template (done with threejs and shader):

> **[lebarba/WebGLVolumeRendering](https://github.com/lebarba/WebGLVolumeRendering)**
>
> WebGL Volume Rendering made easy. Contribute to lebarba/WebGLVolumeRendering development by creating an account on GitHub.

  

> <https://github.com/lebarba/WebGLVolumeRendering/blob/master/Web/Index.html>

The main part is solved with shader code. I tried to port the shader code (providing `attributes`, `uniforms`, `samples` and changing the provided uniforms to match babylonjs names).  
The shader does compile for now, and the first pass shader (simple) looks correct.

I’m new to multi pass rendering and shaders, so please bear with me 🙂

I’ve got at least one problem with the multi pass rendering, at least that is what i’m thinking.

**Playground with my progress so far:** [https://playground.babylonjs.com/#Z8BXU0#12](https://playground.babylonjs.com/#Z8BXU0#12)

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/1/1f9d94a6d7d350762a16b7537473c91d23ba3bb5.png)

What am i missing, is the definition of of the render list correct and is the correct box pushed into it?  
I’m pushing the same mesh that holds the RenderTarget Texture…

```auto
scene.customRenderTargets.push(renderTargetTexture);
...
pass2Shader.setTexture("tex", renderTargetTexture);
renderTargetTexture.renderList.push(boxPass2);

```

Is there already another approach? I couldn’t find anything on it with babylonjs ☹

---

<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:** [October 16, 2020, 5:50pm UTC](https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966/2 "2020-10-16T17:50:43Z")

</div>

Well it seems to be the case. Maybe you can leverage ProceduralTextures as well

Why not creating a simple repro in the PG of what you need to achieve and we can collectively make it work?

---

<div class="post-metadata">

**Author:** ![mmmovania](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/mmmovania/32/25857_2.png) [@mmmovania](https://forum.babylonjs.com/u/mmmovania)\
**Post date:** [August 16, 2022, 4:32pm UTC](https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966/3 "2022-08-16T16:32:32Z")

</div>

Although I am a bit late but I have a working solution for those who are still stuck.  
PG: [Basic Multipass Volume Renderng | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#GBMUJ8#24)

---

<div class="post-metadata">

**Author:** ![MaxOSchulte](https://avatars.discourse-cdn.com/v4/letter/m/3be4f8/32.png) [@MaxOSchulte](https://forum.babylonjs.com/u/MaxOSchulte)\
**Post date:** [April 30, 2024, 5:47am UTC](https://forum.babylonjs.com/t/volumetric-rendering-with-shader-and-2d-textures-multi-pass/14966/4 "2024-04-30T05:47:43Z")

</div>

VERY NICE! thank you for sharing!
