[SOLVED] Post Effects for specific Layer

When applying the bloom effect in the project, I want it to only work for models with a certain layer. Is there a solution where I can do this without using two cameras? I saw a question like this in the forum, but I couldn’t quite understand the solution steps:

X → The layer where I want the Bloom effect to work
Other objects → World Layer
Objects with effect → World Layer + X Layer

AFAIK, the post processing is done on a camera basis as it processes what has been rendered so unfortunately you will need to stack cameras to only apply post processing to specific layers

@mvaligursky Might have other ideas on how this could be done?

1 Like

Here’s a similar discussion

I don’t think you can do this without additional camera / render targets.

3 Likes

Thanks for the quick answers @yaustar @mvaligursky :pray:, I will fix this issue with two cameras.

Hi @mvaligursky,

I tried to change the rendering order of the bloom effect with two cameras. But in all the hierarchies I made, the effect that was supposed to only affect the bloom layer worked on all objects. I couldn’t solve this problem according to the example you gave.I am attaching my sample project here. What solution can you suggest me?

https://playcanvas.com/editor/scene/1462436

I’ve been doing some tests, but didn’t go to the source code. Tried to play with these parameters:

  1. Camera priority
  2. onPreRender and onPostRender to activate and deactivate the effects
  3. Change the uniforms of the effect directly
  4. Enable/disable the script-effect

I may be wrong, but at this moment I think the next:

  1. The effect apply to one camera is applied in cascade to the next ones. So if you have 3 cameras and the bloom effect is in the second one, it will affect the third too.
  2. I tried to deactivate the effect enabling/disabling the effect and modifying the uniform, none of them worked. My guess is that Playcanvas first renders all the cameras and later apply the effects.
  3. Playcanvas renders each layer keeping in mind the depth data and transparency, but you lose all that data when applying the bloom effect and you may overlap the layers in the wrong way.

@yaustar , could you please confirm the bold parts?

I manage partial successes yesterday while testing. I leave here a project I used for that (very dirty because it was for learning).

https://playcanvas.com/editor/scene/1462959

1 Like

Well, it was already solved here, as stated above:

1 Like