Introduce renderer.setPostProcessing()#18322
Conversation
|
Other than developer convenience and a simpler API, are there more advantages to doing this? I don't know the current state of using EffectComposer with WebXR, for example... is that hard now? easier or harder with this API? If we do prefer the proposed API but simply want to keep EffectComposer out of core, one option might be to let WebGLRenderer be given a composer by the user. Similar to how import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
// ...
renderer.setEffectComposer( new EffectComposer() );
renderer.setPasses( [ ... ] ); |
|
Thanks for the comments. Before replying I'd like to ask @mrdoob if the suggested API is what he expects because the new API is originally his idea and if I misunderstood his idea the discussion can be mess so just in case. |
This comment has been minimized.
This comment has been minimized.
|
@donutcoffee I think your post better fits to the following discussion: #12115 |
|
Closing in favor of #12115 (comment) |
From #15840 (comment)
I'm working on
renderer.setPostProcessing()API trial, that is supporting post processing API in core. I want feedbacks so this PR is draft for now.Suggested API
Example
Unreal bloom post processing example.
Changes
I'm trying to move
EffectComposerin core so far.EffectComposer.jsfromexamplestosrc. Also movePass.js,ShaderPass.js,MaskPass.js, andCopyShader.js,EffectComposerrequires, tosrc. Other concrete passes (e.g.UnrealBloomPass) are still underexamples.Pass,ShaderPass,MaskPass, andCopyShaderfromsrc/Three.jsWebGLRendererEffectComposerinstance and holds it inside.renderer.setPostProcessing()which adds passes to the composer.renderer.render()renders a scene to composer's read buffer and then runs composer if the composer has passes.examples, I updatedwebgl_postprocessing,webgl_postprocessing_afterimage, andwebgl_postprocessing_unreal_bloomin this PR so far.Advantages
EffectComposer.webgl_postprocessing)Discussion
EffectComposeruse cases. In some use casesRenderPass(rendering a scene) is a second or later pass (e.g.webgl_postprocessing_backgroundsexample).There might be more complex cases. For compatibility, I'm thinking about exporting
EffectComposerfromsrc/Three.js. Good point is users who still want to directly useEffectComposerfor complex use cases, they can keep using it without big their code change. They just needs to change the location where importing the composer from. Bad point is there will be two ways to apply post processing for users,renderer.setPostProcessing()andEffectComposer. It might be confusing./cc @mrdoob