Apply Bloom only to specific Materials

I’ve create an issue to get this fixed https://github.com/playcanvas/engine/issues/2941

Thanks a lot. looking forward to the fix. I also really appreciate all the support from the devs and the community.

3 Likes

@mvaligursky Hi,thanks so much for your advice!It really helps!
I am trying to achieve this effect accroding to your sceond method,using alpha channel.But I am stuck at the correct way to mark the meshes to bloom,can you describe more precisely?How can I achieve that?

1 Like

This would also interesst me, it also sounds like an faster approach.

SpectorJS is your friend … you can capture the frame and inspect what is going on, including shaders.
You will most likely find that all shaders on opaque meshes output 1 in alpha channel … or maybe all 0, not sure, capture frame and look at the shader.

You need to modify shaders so that meshes you want bloomed output 1, and others output 0 (or grayscale depending on level of bloom).

At the moment bloom shader converts pixel into greyscale and if it’s brighter than some value it blooms it. You would instead read that alpha value from the texture to decide if it should bloom.

2 Likes

sorry for being annoying but are there any plans for the this to get fixed soon ?

There’s been no progress on this yet unfortunately.

1 Like

@Sinlyu This was just merged:

This will be deployed as 1.40.5 - hopefully today or tomorrow.

4 Likes

Looks like we’ll deploy on Monday now.

1 Like

still looks like that its not working on 1.40.5

Test Scene:
https://launch.playcanvas.com/1102500?debug=true

@mvaligursky?

1 Like

here’s an engine example showing how this works, please compare the code to wha you do perhaps?

And also perhaps describe what you do here so that we can see if there’s a problem with your process? Is it something that worked for you in some of the previous engines or is this a brand new code that doesn’t work.

1 Like

@mvaligursky
Looking at your demo, and i dont find anything thats off.

i created an texture, an renderTarget, i have my layers specificed, i did set the priority on my second camera and enabled bloom on the second camera.

could you attach the log with logRenderActions enabled please, to see the overall set up of cameras and layers

1 Like

Sure,

all that seems ok … capture using Spector JS seems to confirm that as well.
And what do you do with the texture that’s part of the bloom render target? Are you displaying it somewhere?

Try debug displaying it this way
app.renderTexture(-0.6, 0.7, 0.6, 0.3, texture);

1 Like

i display it on a plane. but the bloom is not applied.

with app.renderTexture:

So I’m looking at the applyBloom - where do you set up bloom to apply to the texture? Or that elsewhere? Something along this from my example

textureCamera.addComponent("script");
            textureCamera.script.create("hueSaturation", {
                attributes: {
                    hue: 0.0,
                    saturation: 0
                }
            });

is that applied in the editor? Can you try and apply that using script … perhaps the order is the problem.

1 Like

Yea it is applied in the editor, will change that.

@mvaligursky
adding / activating the post processing after the setup works.

resizing has a strange effect on the whole output for some reason.