Post processing textures generated through RTT

I have generated a texture called ‘diffuseTexture’ through RTT using custom shaders, as I only intend to find the irradiance.
https://playground.babylonjs.com/#1OH09K#2126
Next I want to do achieve a custom Post processing on the ‘diffuseTexture’.

How can I pass texture in PP pipeline.
Can you please show it for an inbuild post-processing effect like blur on ‘diffuseTexture’?

cc @Evgeni_Popov

1 Like

I think TextureTools.ApplyPostProcess is what you are after?

1 Like

Hi thanks for replying @carolhmj @Evgeni_Popov .

I didn’t find any example for ApplyPostProcess and struggling.

https://playground.babylonjs.com/#1OH09K#2127

I tried this but got some error.

I don’t know how to handle the promise returned by ApplyPostProcess.
Promise<InternalTexture>

Also, can I pass a custom PostProcessing shader in ApplyPostProcess? This is my final goal.

Actually, ApplyPostProcess is probably not what you want because it creates a new texture each time.

You can do something like this instead:

In this PG, a post process is applied to the diffuse RTT each frame (you can see the result in the inspector).

1 Like

Thank you, Yes this is exactly what I need.

For the blurPP I am getting somewhat of a weird result.
I guess I am close though. Is this some sampling issue?
https://playground.babylonjs.com/#1OH09K#2132

Because the post process is not used in the context of a post process chain, the width and height properties are not set. You should set them with the right values:

2 Likes

Thank you so much @Evgeni_Popov