# Custom shader + graphics bug

**URL:** <https://phaser.discourse.group/t/custom-shader-graphics-bug/3008>\
**Category:** Phaser 3\
**Created:** [July 5, 2019, 4:01am UTC](https://phaser.discourse.group/t/custom-shader-graphics-bug/3008 "2019-07-05T04:01:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Cho](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/gabriel_cho/32/1327_2.png) [@Gabriel\_Cho](https://phaser.discourse.group/u/Gabriel_Cho)\
**Post date:** [July 5, 2019, 4:01am UTC](https://phaser.discourse.group/t/custom-shader-graphics-bug/3008/1 "2019-07-05T04:01:54Z")

</div>

Hi, i have a simple “grayscale” shader as follows:

```
var gray = `
#define SHADER_NAME GRAY_SHADER
precision mediump float;
uniform sampler2D uMainSampler;
varying vec2 outTexCoord;
varying float outTintEffect;
varying vec4 outTint;
void main() {
  vec4 color = texture2D(uMainSampler, outTexCoord);
  float c = color.r*0.3+color.g*0.4+color.b*0.3;
  gl_FragColor = vec4(c,c,c,color.a);

```

}`;

and in my preload():  
this.gray = new Phaser.Renderer.WebGL.Pipelines.TextureTintPipeline({  
game:this.scene.game,  
renderer:this.scene.game.renderer,  
fragShader:gray  
});  
this.scene.game.renderer.addPipeline(“gray”, this.gray);

and in my create(), i add one sprite and one graphics:  
var g = this.scene.add.graphics();  
g.clear();  
g.fillStyle(0xff000000);  
g.fillRect(0, 0, this.width, this.height);  
var img = this.scene.add.sprite(0, 0, “someImageKey”);  
img.setPipeline(“gray”);

When I run this, graphics doesn’t show. If I comment out img.setPipeline(“gray”), the graphics shows up fine. Is this a bug?

gabe

---

<div class="post-metadata">

**Author:** ![Gabriel\_Cho](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/gabriel_cho/32/1327_2.png) [@Gabriel\_Cho](https://phaser.discourse.group/u/Gabriel_Cho)\
**Post date:** [July 7, 2019, 3:05am UTC](https://phaser.discourse.group/t/custom-shader-graphics-bug/3008/2 "2019-07-07T03:05:26Z")

</div>

Confirmed that this bug is fixed in 3.18.1
