# Post processing textures generated through RTT

**URL:** https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651
**Category:** Questions
**Tags:** shader, render-target, postprocessing
**Created:** [June 16, 2023, 7:37am UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651 "2023-06-16T07:37:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![gfxnoob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gfxnoob/32/32783_2.png) [@gfxnoob](https://forum.babylonjs.com/u/gfxnoob)
#### Post date: [June 16, 2023, 7:37am UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/1 "2023-06-16T07:37:02Z")

</div>

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](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’?

---

<div class="post-metadata">

### Author: ![carolhmj](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/carolhmj/32/25918_2.png) [@carolhmj](https://forum.babylonjs.com/u/carolhmj)
#### Post date: [June 16, 2023, 11:24am UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/2 "2023-06-16T11:24:19Z")

</div>

cc @Evgeni_Popov

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [June 16, 2023, 11:34am UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/3 "2023-06-16T11:34:22Z")

</div>

I think [TextureTools.ApplyPostProcess](https://doc.babylonjs.com/typedoc/modules/BABYLON#ApplyPostProcess-1) is what you are after?

---

<div class="post-metadata">

### Author: ![gfxnoob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gfxnoob/32/32783_2.png) [@gfxnoob](https://forum.babylonjs.com/u/gfxnoob)
#### Post date: [June 16, 2023, 12:28pm UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/4 "2023-06-16T12:28:25Z")

</div>

Hi thanks for replying @carolhmj @Evgeni_Popov .

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

[https://playground.babylonjs.com/#1OH09K#2127](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](https://doc.babylonjs.com/typedoc/classes/BABYLON.InternalTexture)\>

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

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [June 16, 2023, 1:09pm UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/5 "2023-06-16T13:09:56Z")

</div>

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

You can do something like this instead:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1OH09K%232129)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

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

---

<div class="post-metadata">

### Author: ![gfxnoob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gfxnoob/32/32783_2.png) [@gfxnoob](https://forum.babylonjs.com/u/gfxnoob)
#### Post date: [June 16, 2023, 1:49pm UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/6 "2023-06-16T13:49:31Z")

</div>

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](https://playground.babylonjs.com/#1OH09K#2132)

---

<div class="post-metadata">

### Author: ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)
#### Post date: [June 16, 2023, 1:59pm UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/7 "2023-06-16T13:59:52Z")

</div>

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:

> **[Babylon.js Playground](https://playground.babylonjs.com/#1OH09K%232133)**
>
> Babylon.js playground is a live editor for Babylon.js WebGL 3D scenes

---

<div class="post-metadata">

### Author: ![gfxnoob](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/gfxnoob/32/32783_2.png) [@gfxnoob](https://forum.babylonjs.com/u/gfxnoob)
#### Post date: [June 16, 2023, 2:36pm UTC](https://forum.babylonjs.com/t/post-processing-textures-generated-through-rtt/41651/8 "2023-06-16T14:36:21Z")

</div>

Thank you so much @Evgeni_Popov
