i am trying to apply bloom to a specific material, but i am still unsure how to approach this issue in playcanvas. is here someone that already tried something similar or someone who can give me some hints, how to achive such a thing.
tl;dr: i have a light material with an emission map and i only want the light materail to glow / bloom.
Make sure you have a camera that renders that layer. Without a code snippet it will be hard to tell what is wrong. You can also check this example and see if there are steps you missing: https://playcanvas.github.io/#graphics/post-effects.html
change the current camera that render the world to be at priority 1 (so it renders second)
add a child camera to current camera, with the same perspective settings. Making it a child should make it have the same transformation. Call it BloomCamera, set its priority to 0 ( so it renders first), add a layer to it with objects you want bloomed. And set it up to render to a render target texture. And clear color to black on this camera.
Attach bloom postprocessing to this BloomCamera - this should bloom only the object that you rendered to it.
To your main camera set up some callback, for example on before UI layer gets rendered. This should additively blend the bloomed renderer target texture on top of already rendered framebuffer of the main camera.
Thank you for your help. i could not find anything on how to blend the texture into the framebuffer. Do you have some example for that. for the callback i thought about using “uiLayer.onPreRender”.
Blend texture to framebuffer … this basically means to render full screen quad using the bloomed textured. As an example you can study post processing effects, such as bloom … they internally render multiple full screen passes for blurring the texture. So you’d need something similar.
And also I’ve relalized … if you only render few objects into the bloom texture and bloom that, it would not interact with the scene in cases something is rendered over the top. Example: you have a character you bloom, but in the scene its only half visible from behind a wall. This solution would bloom and make visible even hidden part of the character. To work around it, you’d need to do a depth pre-pass to your bloom texture - basically render the whole scene bit disable color rendering, and only write to the depth map. That would cause the character to be properly occluded.
Completely different way to approach it would be to use alpha channel of your render target to mask what needs to be bloomed. This way you would render the scene only one time, and during the opaque rendering, change the alpha output to mark meshes you want bloomed - for example character would output 1, everything else would output 0. Then at the end of opaque layers, you’d use this texture to apply bloom based on this alpha channel.
None of these are very easy to set up to be honest.
I did manage to render the Bloom Layer to a Texture. for a test i render the result to a plane. The issue is after i enable bloom on the camera the rendering is empty.
have a l look at here Post Process doesn't work at logRenderActions and try it as well to get a log of what is happening. Perhaps post it here as well.