# Postprocessing with Portal scene

**URL:** <https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052>\
**Category:** Questions\
**Tags:** portal, post-processing\
**Created:** [March 13, 2023, 8:36pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052 "2023-03-13T20:36:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebastien\_lempens](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/sebastien_lempens/32/20763_2.png) [@sebastien\_lempens](https://discourse.threejs.org/u/sebastien_lempens)\
**Post date:** [March 13, 2023, 8:36pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/1 "2023-03-13T20:36:51Z")

</div>

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 😕 Is there a workaround for this ?

Thank you !

---

<div class="post-metadata">

**Author:** ![Nico\_B](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nico_b/32/34439_2.png) [@Nico\_B](https://discourse.threejs.org/u/Nico_B)\
**Post date:** [March 14, 2023, 12:51pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/2 "2023-03-14T12:51:52Z")

</div>

Hi!  
Running into the exact same problem here…

Minimal sandbox forked from example here: [drei/RenderTexture (forked) - CodeSandbox](https://codesandbox.io/s/drei-rendertexture-forked-dg1cx2)

- without postprocessing:

- with postprocessing:

Already had a look at `autoRenderToScreen` parameter which did not solve the problem as it is already set to `false` ([link to the doc](https://pmndrs.github.io/postprocessing/public/docs/class/src/core/EffectComposer.js~EffectComposer.html))

[edit: added actual link to the doc]

---

<div class="post-metadata">

**Author:** ![sebastien\_lempens](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/sebastien_lempens/32/20763_2.png) [@sebastien\_lempens](https://discourse.threejs.org/u/sebastien_lempens)\
**Post date:** [March 14, 2023, 1:56pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/3 "2023-03-14T13:56:56Z")

</div>

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.

```javascript
    <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 🙂

---

<div class="post-metadata">

**Author:** ![Nico\_B](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nico_b/32/34439_2.png) [@Nico\_B](https://discourse.threejs.org/u/Nico_B)\
**Post date:** [March 14, 2023, 2:45pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/4 "2023-03-14T14:45:14Z")

</div>

> [@sebastien\_lempens](#):
>
> ```javascript
> <EffectComposer disableNormalPass scene={nestedScene} camera={nestedCamera}>
> <Bloom luminanceThreshold={0.2} luminanceSmoothing={0.5} radius={10} height={300} />
> </EffectComposer>
> 
> ```

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](https://codesandbox.io/s/drei-rendertexture-forked-emgiv6)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/d/7d60c670687888bdc4f5a5050cf870bc451c82e8.png)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/7/f/7f8b0e29b2639b770c02b1c2a38f0b31fd8832b7.png)

---

<div class="post-metadata">

**Author:** ![Nico\_B](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nico_b/32/34439_2.png) [@Nico\_B](https://discourse.threejs.org/u/Nico_B)\
**Post date:** [March 14, 2023, 4:22pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/5 "2023-03-14T16:22:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![sebastien\_lempens](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/sebastien_lempens/32/20763_2.png) [@sebastien\_lempens](https://discourse.threejs.org/u/sebastien_lempens)\
**Post date:** [March 14, 2023, 9:15pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/6 "2023-03-14T21:15:56Z")

</div>

Sorry I didn’t manage to reproduce it on your code ☹  
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.

---

<div class="post-metadata">

**Author:** ![sebastien\_lempens](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/sebastien_lempens/32/20763_2.png) [@sebastien\_lempens](https://discourse.threejs.org/u/sebastien_lempens)\
**Post date:** [March 18, 2023, 6:27pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/7 "2023-03-18T18:27:57Z")

</div>

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

> **[drei/RenderTexture (forked) - CodeSandbox](https://codesandbox.io/s/drei-rendertexture-forked-bovekp?file=%2Fsrc%2FApp.js)**
>
> Portal a live scene events and all into a texture.

---

<div class="post-metadata">

**Author:** ![Nico\_B](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/nico_b/32/34439_2.png) [@Nico\_B](https://discourse.threejs.org/u/Nico_B)\
**Post date:** [March 20, 2023, 12:33pm UTC](https://discourse.threejs.org/t/postprocessing-with-portal-scene/49052/8 "2023-03-20T12:33:51Z")

</div>

thanks a lot! now working here as well: [gracious-elion-s1bnwd - CodeSandbox](https://codesandbox.io/s/s1bnwd)
