Postprocessing with Portal scene

Hi there!

I created a small plane geometry (not in full screen) with as material a RenderTexture of a nested scene.
Into the RenderTexture I added a EffectComposer (Bloom effect) so that it only be applied to the RenderTexture. Unfortunately the EffectComposer seems to be creating a fullscreen triangle over the
scene instead of being contained within the texture of my plane geometry :confused: Is there a workaround for this ?

Thank you !

Hi!
Running into the exact same problem here…

Minimal sandbox forked from example here: drei/RenderTexture (forked) - CodeSandbox

Already had a look at autoRenderToScreen parameter which did not solve the problem as it is already set to false (link to the doc)

[edit: added actual link to the doc]

I solved the issue by passing the RenderTexture scene & camera to the EffectComposer tag.
I used the onUpdate function from the RenderTexture tag by looping over the __r3f.parent until I retrieve the scene and camera.Then I can apply them to the RenderTexture tag.

    <EffectComposer disableNormalPass scene={nestedScene} camera={nestedCamera}>
      <Bloom luminanceThreshold={0.2} luminanceSmoothing={0.5} radius={10} height={300} />
    </EffectComposer>

This way, my Bloom effect is only applied to the nested scene :slight_smile:

thanks a lot! unfortunately it doesn’t seem to work here… I’ve made another sandbox to test it: https://codesandbox.io/s/drei-rendertexture-forked-emgiv6

@sebastien_lempens do you have some sample code you could upload for me to check what I’m doing wrong?

Sorry I didn’t manage to reproduce it on your code :frowning:
The difference in my project is i’m using 2 nested RenderTexture, maybe that’s why it looks to be working.
I will try to make a codepen project of it… In meantime I hope you will figure out a solution.

Finally I managed to use postprecessing effects into the cube :slight_smile:
I had to use my own prostprocessing effects and play with currrentTargets !

1 Like

thanks a lot! now working here as well: gracious-elion-s1bnwd - CodeSandbox