Help with multipass shader

Hi everyone,



I’m still learning shaders and I’m not familiar with all the ins and outs. I am trying to implement the technique in this paper:

http://developer.download.nvidia.com/presentations/2010/gdc/Direct3D_Effects.pdf



For this technique, it seems I need to have multiple passes to render the water correctly. A depth pass, then a blur pass, then a normal pass, and so on.



I looked at the some of the water processor stuff because I know that has to use multiple textures, but those look as though they operate on the entire scene.



I am hoping to just assign a particle emitter a custom Material, and have that material do all the passes.



How might I approach this with JME? Is there a way to pass the output from a fragment shader as the input to the next shader, chaining them all together? ie: for depth pass, calculate all the depths and pass those into the blur shader



Sorry for my ignorance on the topic

A complex effect like this isn’t possible just by using the material system. You may need to use several framebuffers and chain the materials in a similar way that FilterPostProcessor does it, except you do it per object and not for an entire scene.

Thanks for the pointers about the filter post processor stuff.



I decided to use the existing system and it’s working out just fine. I used a MRT shader to output the particle data to two different textures. One texture was the regular scene (the rendering of rootnode) and output the particles with a single solid colour. The other texture represented the custom depth buffer necessary.



Once the scene was done rendering, I applied a filter using the FilterPostProcessor you mentioned. This would process the whole scene but in my shaders I would disregard any pixels that aren’t of the solid colour that the particles were rendered in. Unfortunately, anything else that is rendered in the exact same colour will also have the technique applied, but thankfully in my situation I have control over preventing that.



It’s still a work in progress, but here’s a screen shot of ‘falling’ water. Once it is more complete I will post a little video

http://i.imgur.com/AmkZp.jpg