Hello everyone!
As far as I understand, the glow layer renders the meshes to a texture, blurs it and the recompose it with the screen buffer. What I want to do is postpone that recomposition step to after my post processes, which tend to overwrite the glow when done in the wrong order:
Another solution could be to disable the recomposition altogether, and then I can perform it myself in my last post-process of my rendering pipeline.
In either case, I don’t know if the glow layer API lets me do that.
Let me know what you think ^^
Unfortunately I do not thing it will be possible without changes. let me check quickly.
1 Like
Yup layers are too deep within the stack and meant to be before post process.
The only thing you could do is probably hook into onBeforeComposeObservable from the layer and for render the post process at this point with a directRender for instance.
I think we can still find a way, here I am applying the glow texture in the shader:
The issue I am facing is that the result is not identical as if I did not use the postprocess at all (try commenting the attachPostProcess
line at the end to see the difference. The glow has less spread when I do the recomposition by hand.
If this approach can work, then we are still wasting one shader pass with the original merge pass than happens before post processing. Is there a way to disable that merge pass?
You are applying the wrong texture. it should be _blurTexture1 and 2 also disabling the merge is kind of really edge case to be added as a feature.
I would suggest you create a new Layer maybe similar to how glow and highlight have been developed or try to hack your way in 
Something like this might do:
const compo = scene._getComponent(SceneComponentConstants.NAME_EFFECTLAYER);
compo.prototype.drawit = compo.prototype._draw.bind(compo);
compo.prototype._draw = () => {};
// then call compo.drawit(-1) when you want;
Thanks for the lead, I will investigate! Maybe I can also get away by overriding the merge function 
I will report if I have something interesting ^^