Render 2 scenes with transparency with EffectComposer

I want to make two scenes, one in the background and another where there is a character that will receive the elements of the first scene as reflections in the envMap through a Cube Camera. The background scene is a nebula with moving stars that I found on git hub and is already perfectly configured.

The scene in the background is a scene from a Git hub repository known as space-travel, in short, in this scene there is a nebula and some stars that are They move towards the camera, but do not have a collision. Since this movement is made through a custom shader.

The character scene is a backgroundless scene with EffectComposer to enhance the lighting effects of that character.

For some reason, what happens is that this second scene is completely covering the background scene with a gray color. However, when I stop using the EffectComposer, and render the scenes with the renderer, the transparency is applied and looks correct.

The main reason why I am using the same renderer for both scenes, is that as I was reading in another thread of this forum, the render targets cannot be used in other renderers, since they look like a black texture.

I would like to know how I could use the EffectComposer in the same way that I achieve transparency using the renderer directly.

I am attaching the github repository where I have this test project, so that someone can guide me a little on how I could do it.

Thanks in advance.

1 Like

¿Podría cambiar el nombre de su consulta en inglés para que el resto de la comunidad pueda interactuar con ella? Gracias

There are properties on the effectcomposer passes that determine whether the screen should be cleared between passes… it might be that after your first scene pass is rendered, the second one is clearing the buffer before painting on top?

It would be great if you could make a minimal reproduction in glitch or codepen, that highlights the issue and we can dig into it further…

Hello, thank you for your response, I have been researching a little more about buffers in the documentation and in other forums, and I made a small progress, I can see the background scene, but with a very intense and annoying flickering.

Likewise, in my first post, I left a link to my project on github ready to download. I tried to upload it to codepen and glitch, but I don’t know how I can convert my structure into the one necessary for it to work on those sites. Sorry for the disturbances.