Yes, I have referred to that, but I have a scene which add new model to scene … so it that case I have to add and remove mesh from global state based on adding and deleting of new models.
But I do have that in consideration and most probably end up there if I don’t find any other solution.
in my opinion this is using bloom wrong. the official threejs example is very misleading. by using layers and rendering on top you’ll loose depth write. no need to go through all this trouble when bloom can select out of the box without you having to do anything at all. you don’t need layers, copy shaders, double render, clear color. all you need is “emissiveIntensity” on your materials, this is how you control which meshes are glowing.
THREE.ColorManagement.legacyMode = false
...
renderer.outputEncoding = THREE.sRGBEncoding
renderer.toneMapping = THREE.ACESFilmicToneMapping
...
const target = new THREE.WebGLRenderTarget(width, height, {
type: THREE.HalfFloatType,
format: THREE.RGBAFormat,
encoding: THREE.sRGBEncoding,
})
target.samples = 8
const composer = new EffectComposer(renderer, target)
composer.addPass(new RenderPass(scene, camera))
composer.addPass(new ShaderPass(GammaCorrectionShader))
// Setting threshold to 1 will make sure nothing glows
composer.addPass(new UnrealBloomPass(undefined, 1, 1, 1))
// This mesh will glow because emissive leaves 0-1 range, everything else won't
const mesh = new THREE.Mesh(
geometry,
new THREE.MeshStandardMaterial({
toneMapped: false,
emissive: "red",
emissiveIntensity: 10
})
)
it won’t matter if the color is white, if threshold is 1 and everything’s correctly configured nothing at all can have glow, only materials that go into HD range. there’s something that must be off. did you set srgb? the webglrendertarget? is threshold 1? emissive on the floor 0 or <=1 ?
Thankyou @drcmda it worked like a charm. It was completely my mistake, I missed to set toneMapped, and now it works.
Now have to fix color … it’s not what I was expecting it’s due to gammaCorrectionShader… maybe playing with exposure would give the result I want … on to next mission. Thank you again.