Volumetric Rendering with shader and 2D Textures - multi pass

Hello together :slight_smile:

i’m trying to implement volumetric rendering with babylonjs.

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


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 :slight_smile:

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

image

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…

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 :frowning:

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?

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)

4 Likes