question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Render the same scene with more composers and cameras

See original GitHub issue

Hello! I’m sorry to open a new issue but I haven’t found a solution among the previous issues

Description of the bug

The scenario is as follows:

  • 1 scene
  • 2 composer: one that renders the scene directly to the screen, the other is used with lower resolution (512x512) to save the scene seen from a virtual camera (in order to create a reflector)
  • 2 camera: the main camera, and the virtual camera for the reflector

The postprocessing pipeline is therefore as follows:

    const composer = new EffectComposer(renderer, { frameBufferType: HalfFloatType, multisampling: 0 })
    composer.setSize(screenWidth, screenHeight)

    const targetComposer = new EffectComposer(renderer, { frameBufferType: HalfFloatType, multisampling: 0 })
    targetComposer.autoRenderToScreen = false
    targetComposer.setSize(512, 512)

    targetComposer.addPass(lambdaPassBefore) // <- someMesh.visible = false
    targetComposer.addPass(renderPass)
    targetComposer.addPass(savePass)
    targetComposer.addPass(lambdaPassAfter) // <- someMesh.visible = true

    composer.addPass(renderPass)

    function render(now) {
        requestAnimationFrame(render);
        targetComposer.render(clock.getDelta());
        composer.render(clock.getDelta());
    }

I have three significant cases:

1 - Use only the main composer (no targetComposer.render(clock.getDelta())) The scene is perfect and it renders at 60fps, but obviously there is no reflector

Schermata 2021-01-20 alle 21 23 59

2 - Use both composers (ideal case) Render everything perfectly but at 10fps, if not less

Schermata 2021-01-20 alle 21 24 58

3 - Use both composers, but adding an EffectPass after the main composer RenderPass

    composer.addPass(renderPass)
    composer.addPass(effectPass)

in this case I easily reach 60fps with the reflector but the colors are wrong, it would seem almost a mapping with fewer bits, I don’t really know…

Schermata 2021-01-20 alle 21 24 38

Am I doing something wrong?

To Reproduce

Here is the csb file where postprocessing is used: https://codesandbox.io/s/r3f-ibl-envmap-simple-forked-jfrl5?file=/src/use-postprocessing.js:507-554

Library versions used

  • Three: 0.124.0
  • Post Processing: 6.20.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
vanruesccommented, Jan 22, 2021

Closing this as it seems to be resolved.

0reactions
vanruesccommented, Jan 21, 2021

that one tiny bit , encoding: gl.outputEncoding made all the difference! thank you!

Nice, but be careful not to convert to sRGB twice! If you use the rendered sRGB texture in a custom material you might need to convert it to linear via three’s built-in conversion function mapTexelToLinear. Otherwise results will be brighter than they should be.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toggle between multiple THREE.EffectComposer scenes ...
So my question is if I have a second scene which a composer instance how can I then: Use the same renderer (if...
Read more >
How to render two scenes using effectcomposer - three.js forum
I want to use the effectcomposer to render two scenes, just like using ... the same function, like this renderer.render(scene, camera) renderer.
Read more >
I had 3 composers re-score the SAME scene! - YouTube
Composers wrote NEW music for a Legolas fight scene from The Hobbit! 5 Orchestration Hacks to Make You an AMAZING FILM...
Read more >
Viewport Properties - Composer User's Guide
If you have multiple viewport panes, Camera is animatable for the main viewport ... and receive shadows, making rendering for lighted scenes more...
Read more >
Three.js Postprocessing Effect Tutorial - Red Stapler
So same as previous tutorial. ... let scene, camera, renderer, controls; ... Postprocessing render can happen multiple times if you add ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found