Converting a filter to PIXI v4

Datetime:2016-08-22 23:08:58         Topic: Game Development          Share        Original >>
Here to See The Original Article!!!

In PIXI v2, i was using the following fragment filter to convert a texture from rectangular to polar coordinates, as part of a process to create a shadowmap:, [
    '#define PI 3.14',
    'precision mediump float;',
    'varying vec2 vTextureCoord;',
    'uniform sampler2D uSampler;',
    'void main(void) {',
    '    vec2 norm = vTextureCoord * 2.0 - 1.0;',
    '    float theta = PI + norm.x * PI;',
    '    float r = (1.0 + norm.y) * 0.5;',
    '    vec2 coord = vec2(-r * sin(theta), -r * cos(theta)) / 2.0 + 0.5;',
    '    gl_FragColor = texture2D(uSampler, coord);',

The first 2 pictures in this thread show an example of how the filter works:

However, with PIXI v4 (and maybe v3, i skipped that one), the resulting image looks like this:

Furthermore, the result changes, depending on the position of the sprite on the screen, which is something i don't think v2 did.

Has anyone tried to do something similar in v4 and can point me in the right direction?


Put your ads here, just $200 per month.