Jump to content

Using custom shader in pixi v4


Exca
 Share

Recommended Posts

I'm upgrading v3 project to v4 and I have some custom shaders done for few sprites. For some reason these dont get used in v4 no more. Should I use filters instead?

I'll create an example case if needed later this week.

Link to comment
Share on other sites

API for shaders was changed.

http://pixijs.github.io/examples/index.html?s=basics&f=custom-filter.js&title=Custom%20Filter&v=dev works just fine.

Shader is:

precision mediump float;

varying vec2 vTextureCoord;
varying vec4 vColor;

uniform sampler2D uSampler;
uniform float customUniform;

void main(void)
{
   vec2 uvs = vTextureCoord.xy;

   vec4 fg = texture2D(uSampler, vTextureCoord);


   fg.r = uvs.y + sin(customUniform);

   //fg.r = clamp(fg.r,0.0,0.9);

   gl_FragColor = fg;

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...