pixijs / filters

Collection of community-authored custom display filters for PixiJS
https://pixijs.io/filters/docs/
MIT License
945 stars 160 forks source link

[BUG: ShockwaveFilter] When canvas isn't a square , the wave is not a circle. #55

Closed finscn closed 6 years ago

finscn commented 6 years ago

I think the code for computing dist has bug.

bigtimebuddy commented 6 years ago

I don't know what you mean. Can you try explaining or showing?

finscn commented 6 years ago

The shape of shockwave is not always a circle.

2017-10-12 7 00 25 2017-10-12 7 00 18

Only When the canvas is a square , The shape of shockwave is circle.

bigtimebuddy commented 6 years ago

I believe that's intentional.

finscn commented 6 years ago

Why ? in the real game, what ever the game resolution ( 4:3 or 16:9 ) , the shockwave should always be a circle.

finscn commented 6 years ago

@bigtimebuddy . in filter , I use this code for computing the distance of a texture-point and center : (uCenter use viewport coord, the unit is pixel )

    vec2 center = uCenter.xy / filterArea.xy;
    vec2 dir = vec2(center - vTextureCoord);
    float dist = length(vec2(dir.x, dir.y * filterArea.y / filterArea.x));
finscn commented 6 years ago

done with https://github.com/pixijs/pixi-filters/pull/95