Nixa Posted August 31, 2019 Share Posted August 31, 2019 I'm working on a project in PIXI v4, using AdvancedBloomFilter. It works great after it loads. But right when it first renders, there's a performance hit. Chrome Devtools shows the delay in AdvancedBloomFilter's apply function, which deeper down has a long call to getShaderParameter. My understanding is that this is happening at compilation time for the shader, querying for success. What's the best approach to improve performance here? What could be causing the delay? Is it expected? This delay is causing stutter at a crucial moment. If the delay is unavoidable, is there a strategy for pre-loading? Should I set the stage, add the filters, and just keep it at alpha=0 until I'm ready for it? Any advice greatly appreciated. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 31, 2019 Share Posted August 31, 2019 Yep, just pre-bind all those shaders and it'll be fine. I guess in v4 the easiest way is to assign each unique filter to some container and call `renderer.render(container, tempRenderTexture)` on it. Quote Link to comment Share on other sites More sharing options...
jonforum Posted August 31, 2019 Share Posted August 31, 2019 on my side i create a Class system, where i prebuild and cache all scenario for Filters,Styles,MathEasings. This will avoid to call new constructor each time you need heavy features. i didn't notice spike Lag on first use! Quote Link to comment Share on other sites More sharing options...
Nixa Posted August 31, 2019 Author Share Posted August 31, 2019 Awesome. Thank you both so much! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted August 31, 2019 Share Posted August 31, 2019 The thing is - some filters have different shaders depending on the case, you need to know about them and put them there. No need to put 10 ColorMatrices for example, 1 is enough. But outline, glow - look in the source code whether they have template 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.