Joery1 Posted May 29, 2017 Share Posted May 29, 2017 Hey, I am trying to position my container to a floating point number, that is possible. But the filter I applied does only move every integer, which makes my animation not smooth. Code, or jsfiddle: https://jsfiddle.net/08pdhrff/10/ var test = new PIXI.Sprite(); test.width = 512; test.height = 512; test.position.x = 0.5; // <- this test.position.y = 0.5; app.stage.addChild(test); var filter = new CircleFilter(); test.filters = [filter]; I am guessing that I am doing it completely the wrong way. Thank you, Joery Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 29, 2017 Share Posted May 29, 2017 Before filter is being applied, container is rendered into separate RenderTexture, which works only with int coords. You can't detect fractional offset inside the shader, unless you map sprite matrix to a parameter. According to https://github.com/pixijs/pixi.js/wiki/Creating-Filters-in-Pixi-v4 , you have to pass mapped matrix as a parameter, like DisplacementFilter does. You dont need extra texture, you dont need extra sprite, your filter just have to pass your original sprite matrix to the uniform, and read it on shader side to determine the real center of the sprite. Quote Link to comment Share on other sites More sharing options...
Joery1 Posted May 29, 2017 Author Share Posted May 29, 2017 1 hour ago, ivan.popelyshev said: Before filter is being applied, container is rendered into separate RenderTexture, which works only with int coords. You can't detect fractional offset inside the shader, unless you map sprite matrix to a parameter. According to https://github.com/pixijs/pixi.js/wiki/Creating-Filters-in-Pixi-v4 , you have to pass mapped matrix as a parameter, like DisplacementFilter does. You dont need extra texture, you dont need extra sprite, your filter just have to pass your original sprite matrix to the uniform, and read it on shader side to determine the real center of the sprite. Thank you for your answer! I think I will just stick with PIXI.Graphics, the time I will spent trying to figure it out is probably not going to be worth the tiny performance improvement. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.