robojiannis Posted February 27, 2018 Share Posted February 27, 2018 Hi, I'm trying to implement the pixi-v4 filters in phaser 2 (CE Version). I'm especially interested in this one: https://github.com/pixijs/pixi-filters/tree/master/filters/zoom-blur I've noticed this example (http://phaser.io/examples/v2/filters/pixi-filter) in phaser 2 is outdated/not working (link to pixi filter is wrong). Even when i fix the link (e.g. https://github.com/photonstorm/phaser/blob/v2.6.2/filters/pixi/RGBSplitFilter.js) the filter gives an error because pixi is not included. So I'm wondering what is the right method to do it. I guess the main questions here are: is pixi-v4 filters compatible with phaser-v2 method of importing of pixi filters? if yes, where are the new filters (interested in the zoom-blur one: https://github.com/pixijs/pixi-filters/tree/master/filters/zoom-blur)? if not, any pointers how to port them? Thanks! Link to comment Share on other sites More sharing options...
samme Posted February 27, 2018 Share Posted February 27, 2018 Download and build the pixi-v4 filters, then work from SampleFilter.js. Link to comment Share on other sites More sharing options...
veggis Posted February 28, 2018 Share Posted February 28, 2018 @samme Sorry but could elaborate abit on that? Wouldn't that require to swap pixi v3 with v4? Link to comment Share on other sites More sharing options...
robojiannis Posted February 28, 2018 Author Share Posted February 28, 2018 I actually made some progress. The filter is now running without throwing any errors, but nothing is visible below (although things are there; i tested by applying the filter to one sprite only instead of the game.world) Here's the filter: https://gist.github.com/robojiannis/bd31ab833aec776791f9bcae62e123b8 and i call it like that: f = new Phaser.Filter.ZoomBlur(game); f.strength = 0.1; f.innerRadius = 80; f.radius = 1; f.center = [500,300]; game.world.filterArea = new Phaser.Rectangle(); game.world.filters = [f]; any clues? Link to comment Share on other sites More sharing options...
veggis Posted February 28, 2018 Share Posted February 28, 2018 Added the filter to a sprite of the phaser logo. It did something alright. Changing the filter properties didn't seem to do anything whats so ever. I have little to no knowledge with shaders, so i have no idea whats going on. Link to comment Share on other sites More sharing options...
robojiannis Posted February 28, 2018 Author Share Posted February 28, 2018 that's exactly where I'm stuck. The shader should actually do a zoom blur like here: http://pixijs.io/pixi-filters/tools/demo/ (enable the last filter). Instead it does something, but not what we want Link to comment Share on other sites More sharing options...
veggis Posted February 28, 2018 Share Posted February 28, 2018 My guess is that these filters requires pixi v4, but idk. If its possible to extract the shader code from them that would be awesome! Keep me posted Link to comment Share on other sites More sharing options...
Recommended Posts