Sahil Posted May 2, 2018 Share Posted May 2, 2018 Hi, I was working on some effect using rectangles using graphics object. @OSUblake Suggested me that using Sprites with tint would give me be better performance. So I decided to replace my graphics object with sprites. Though scaling them and positioning them to scale from center gives me some strange behavior which is because I guess that sprites are calculated based on canvas dimensions. Then I removed the height and width from sprite and they defaulted to 10x10 rectangle that ignores the dimension of canvas. So I can work with it and avoid doing calculations to position all the sprites. https://codepen.io/Sahil89/pen/PemgeO?editors=0010 Following are my questions 1. Is it safe to assume that in all browser environments sprites will default to 10x10 dimensions? 2. How much difference does it make in performance to use sprites instead of graphics object while am using 1000-1500 rectangles? is it significant? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 2, 2018 Share Posted May 2, 2018 > which is because I guess that sprites are calculated based on canvas dimensions. Make a fiddle. 1. Yes, PIXI.Texture.WHITE size is 10x10. 2. Graphics will automatically be rendered as sprites with whtie texture if they are rectangles. If they aren't , you can have only 50 sprites on mobiles , 200 for PC, everything else starts slowing down because of excessive drawcalls. Sahil 1 Quote Link to comment Share on other sites More sharing options...
Sahil Posted May 2, 2018 Author Share Posted May 2, 2018 Quote Make a fiddle. Don't know what was happening but when I was creating this question, my sprite was getting stretched if I change canvas dimension. Doesn't happen anymore, I must have been doing something wrong. BTW in previous thread you mentioned you write articles, can you post link to your blog? Thanks Quote Link to comment Share on other sites More sharing options...
jonforum Posted May 2, 2018 Share Posted May 2, 2018 https://github.com/pixijs/pixi.js/wiki/v4-Performance-Tips Sahil 1 Quote Link to comment Share on other sites More sharing options...
jonforum Posted May 2, 2018 Share Posted May 2, 2018 3 hours ago, ivan.popelyshev said: 50 sprites on mobiles , 200 for PC, everything else starts slowing down because of excessive drawcalls. ??? here 400 spine animation with pixi without slowing. https://youtu.be/8oGkRMTnReQ 200 for pc ?? I would say rather between 600 and 800 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 2, 2018 Share Posted May 2, 2018 Its because there are no meshes in your models. One drawcall = many spine instances Quote Link to comment Share on other sites More sharing options...
jonforum Posted May 2, 2018 Share Posted May 2, 2018 9 hours ago, ivan.popelyshev said: Its because there are no meshes in your models. One drawcall = many spine instances it true ? 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.