Can not get rendertarget when camera's posteffect is on

Say,I use a rendertarget to draw some layer like this:

worldLayer.renderTarget = myRenderTarget;

Then I can show the captured texture on one of the image:

imageElement.texture= myRenderTarget.colorBuffer;

But when I add some post-effects on camera,the rendertarget is not shown.
Does the post-effects affect all layers on the camera?can I disable post-effects for some specific layers?

also,the example project can be found here:

I dig into the engine code and find this:

But why?I remenber we can still apply rendertarget to layers in the previous version of engine.

Hi @FBplus,

I think your issue is related to this, check it out:


Also see the recommended way to set up rendering to texture

You should set up render target on a camera and not on a layer. See examples here as well:


@mvaligursky Thanks so much for your advice :grin:
BTW I wonder if there is a method to replace all the shader before rendering?like unity does here:
So I can easily mark some special meshes to pure white or pure black for posteffect purpose.
If there’s not,how can I achieve this in playcanvas,can you give me some advice?

There isn’t anything super convenient like this at the moment.
Perhaps you could hook up to layer.onPreRender and change materials / shaders in there.