Render the same scene with more composers and cameras
See original GitHub issueHello! 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
2 - Use both composers (ideal case) Render everything perfectly but at 10fps, if not less
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…
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:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Closing this as it seems to be resolved.
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.