Using multiple RenderPass but rendering to seperate buffers?

I’m trying to write a custom RenderPass method which will allow me to render the same scene but with different materials. My method works, however there is a strange bug that is happening as a result of some shared state between multiple instances of the RenderPass.

My guess is that my instances of RenderPass are writing to the same buffer, which is getting overwritten on subsequent instances of the RenderPass.

I tried to change the RenderPass code where it sets the readBuffer for the renderTarget, but it seems by changing this just breaks the EffectsComposer chain entirely, and now I’m stumped!

Is there any way to make a custom RenderPass that renders to its own buffer, but which is still recognized by Effects Composer?

Here is my code:

I think I MAY have figured out why this isnt working. In effects composer render function i notice that It gets the “current render target” from the renderer like this:

const currentRenderTarget = this.renderer.getRenderTarget();

This might be where my stuff is getting overwritten by using multiple RenderPasses. I’m going ot try writing a custom multipass render function to see if that fixes the problem.

I think I am gonna try and write my own custom multipass render function to see if

OKAY so the issue was actually a bug with the ExtendMaterial library I was using. Problem solved!