V3.25-beta and Custom pipelines

Hi,
As @rich said:

Blockquote I did make a number of significant changes to the Texture Tint Pipeline, however. So if you have written any custom pipelines, especially those that may extend TTP, then you need to check the Change Log to see what’s happened and update your code accordingly.

And of course i use many custom pipelines in my game.
Looking for a basic example, i found this one that don’t work as expected
http://labs.phaser.io/view.html?src=src\renderer\Custom%20Pipeline.js&v=dev

I’m not a pro of shaders, so if someone can help resolve the example.
Thanks

Supposedly, you would only have to edit your pipeline to work with the new multi-texturing features. This isn’t hard to do: https://dpaste.com/AA63AVK2M.

However, this doesn’t entirely solve the problem. All objects drawn by the custom pipeline appear to partially reuse vertex data from the Texture Tint Pipeline (and nothing is rendered at all if there are no objects using the TTP). I haven’t managed to isolate the cause of this yet; as far as I can tell, all of the buffers are being bound and written to correctly. I suspect it may be a Phaser bug, but I may have just missed something in the shader. I’ll debug it more carefully later and report my findings.

1 Like

Thanks @Telinc1
I’ll try to test your code

Figured it out - it’s an obscure renderer bug. You can build a Phaser with my hack fix from the issue or just wait for the issue to be resolved properly.

Thanks
While waiting the release, i looked your commit and just modified the src.
I tried to convert my custom pipelines like you did, but i’m sucks at shaders…
Is there a way to keep this old pipelines working? with maxTextures: 1 perhaps?

That wouldn’t be enough, I fear. The update turns uMainSampler into an array; even with only one texture index in use, you’d still have to modify the shader to work with the new Texture Tint Pipeline. That said, if you’re certain that only one texture is being used, changing uniform sampler2D uMainSampler; to uniform sampler2D uMainSampler[2]; and replacing references to uMainSampler with uMainSampler[1] should be enough.

On another note, setting maxTextures to 1 seems to break rendering, while setting it to 2 works and uses only one texture to render. It’s not the behavior I expected and I might look into it, too.

Edit: Texture 0 is intentionally reserved, so that oddity with maxTextures is not a bug. Still, I couldn’t find obvious documentation about it.

Hi,
Finally with the 3.50-beta2, we can extends SinglePipeline and use our already made pipelines, works great but not 100% like before in all my pipelines.
The glow effect is weird…

          precision lowp float;
          varying vec2 outTexCoord;
          varying vec4 outTint;
          uniform sampler2D uMainSampler;
          uniform float alpha;
          uniform float time;

          void main() {
            vec4 sum = vec4(0);
            vec2 texcoord = outTexCoord;
            // texcoord.y = 1.0 - texcoord.y; // No need to flipY here...
            for(int xx = -4; xx <= 4; xx++) {
              for(int yy = -3; yy <= 3; yy++) {
                float dist = sqrt(float(xx*xx) + float(yy*yy));
                float factor = 0.0;
                if (dist == 0.0) {
                  factor = 2.0;
                } else {
                  factor = 2.0/abs(float(dist));
                }
                sum += texture2D(uMainSampler, texcoord + vec2(xx, yy) * 0.002) * (abs(sin(time))+0.06);
              }
            }
            gl_FragColor = sum * 0.025 + texture2D(uMainSampler, texcoord) * alpha;
          }

Could you elaborate? I tested it and I can’t see a difference between the old Texture Tint Pipeline and the new Single Pipeline.

This is what happens when i use the glow effect on a sprite, you see the bounds of the sprite
image

edit: seems to work fine on phaser examples so it’s a problem in my game

Ok, It seems that using an atlas is causing this weird effect

Finally, after trying to reproduce it with phaser examples, all seems to works fine with atlas.
So i just need to find the bug on my code…
Thanks @Telinc1