Hello everyone, I would like to apply an unreal bloom effect to a subset of elements of my scene.
Reading around it seems it could be possible to render different scenes with different post processing effects using masking provided by the MaskPass.js.
I’ve followed this example https://threejs.org/examples/#webgl_postprocessing_masking and created a plunk with two scenes, one with a cube and one with a sphere.
I would like to apply the bloom effect only to scene1, leaving scene2 uneffected (but still rendered).
At the bottom of the code there are two functions:
addPasses: renders both scene1 and scene2 with the bloom effect
addPassesWithMasking: should render scene1 with bloom effect and scene2 without effects, but it is not working
Can someone share some light on what I am doing wrong? The example uses TexturePass to render textures, here I am using RenderPass, could be the problem?
I’m don’t think the usage of masking makes sense here. You could create a pass chain like presented in the following code snippet but that produces only a acceptable result with wireframes. If the sphere is rendered in normal mode, you will see that the bloom effects gets lost when the cube is in front of the sphere.
A more promising approach is maybe to blend the bloom pass on top of the normal beauty pass (the objects without bloom). But I’m not sure if you can use UnrealBloomPass in this context or if you have to adjust the code.
Oh I see!
Generally speaking, is this the correct approach to mix different shader effects (for different objects) in the same scene? Apologies, I am not very much in 3d graphics, trying to learn
No. Like I said before, blending different rendering results together might be a more promising approach. But the “correct” solution is always use case specific.