# How do I apply a shader on render target texture

**URL:** https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060
**Category:** Questions
**Created:** [June 4, 2024, 5:55pm UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060 "2024-06-04T17:55:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Giang\_Le](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/giang_le/32/38757_2.png) [@Giang\_Le](https://forum.babylonjs.com/u/Giang_Le)
#### Post date: [June 4, 2024, 5:55pm UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060/1 "2024-06-04T17:55:22Z")

</div>

How can I apply a shader to a Render Target Texture? I’m working on a refraction effect, and I want the refraction image to be blurred with the shader before it’s rendered using PBR.

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [June 4, 2024, 7:21pm UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060/2 "2024-06-04T19:21:56Z")

</div>

Can you share a playground of what you tried already ?

---

<div class="post-metadata">

### Author: ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)
#### Post date: [June 4, 2024, 7:27pm UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060/3 "2024-06-04T19:27:28Z")

</div>

Also this could help [Blurry refraction quality - #12 by Evgeni\_Popov](https://forum.babylonjs.com/t/blurry-refraction-quality/32944/12)

---

<div class="post-metadata">

### Author: ![Giang\_Le](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/giang_le/32/38757_2.png) [@Giang\_Le](https://forum.babylonjs.com/u/Giang_Le)
#### Post date: [June 5, 2024, 3:12am UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060/4 "2024-06-05T03:12:38Z")

</div>

I don’t have a playground, I want to write a shader for a texture to create a blur or multi-pass blur effect, for example like this: [Unity - Manual: Custom Render Textures](https://docs.unity3d.com/Manual/class-CustomRenderTexture.html#chaining-custom-render-textures)

---

<div class="post-metadata">

### Author: ![CrashMaster](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/crashmaster/32/23662_2.png) [@CrashMaster](https://forum.babylonjs.com/u/CrashMaster)
#### Post date: [June 5, 2024, 7:33am UTC](https://forum.babylonjs.com/t/how-do-i-apply-a-shader-on-render-target-texture/51060/5 "2024-06-05T07:33:27Z")

</div>

You can use

```ts
scene.postProcessManager.directRender([yourPostProcess], rtt.renderTarget, true);

```

You will probably need 2 render target textures: one for input and one for output

Here is an example: [https://playground.babylonjs.com/#22KZUW#576](https://playground.babylonjs.com/#22KZUW#576)
