Jump to content

PIXI adding bigger animatedSprite cause stutter


Recommended Posts

Hello, html5 freaks :)

I trying to make idle game using pixijs, but when I put animated sprite that is 1024x512 in size it freeze game short time. From profiler I saw  that texImage2d took 180ms and from that 104ms was imageDecode. I read somewhere to preload the animations before hand and just make them visible when needed, but it didn't work and same texImage2d happend. How I can prevent that other than downscaling the sprite?

 

Also is there possibility to do that in webworker? I read somewhere that pixi is starting to be capable of rendering on webworker.


Cheers,
Jakub

pixi skill.png

Link to post
Share on other sites

I read somewhere to preload the animations before hand and just make them visible when needed

basically, PIXI.prepare plugin that actually uses"renderer.texture.bind(myTexture)" .

However there is "createImageBitmap" function and you can use it with pixi resources, but we turned it off by default because we dont actually have good async mechanisms to notify user that everything is loaded, and basic "createImageBitmap" usage affected many parts of pixi. You can enable it if you read the source code first, because i dont remember where is this setting :)

Also is there possibility to do that in webworker? 

decode? yeah, theoretically, i didnt see apps that use it. Its possible workaround, if you do it and it works - please share your experience.

Link to post
Share on other sites

Thanks just added prepare and everything works smoothly now on animated sprite appers. CreateImageBitmap caused some strange behaviours on sprites that have something transparent.

From your experiance do u think  utilizing webworker to do pixi work is worth? I already moved http request to webworker, planning to move characters polygons and calculation to webworker, but I read  here(https://github.com/pixijs/pixi.js/issues/7123) that some user utilized pixi on webworker and thought why not do something similar also for rendering and leave calculation on main thread.

Link to post
Share on other sites

CreateImageBitmap caused some strange behaviours on sprites that have something transparent.

welcome to premultiplied alpha. pass a param named like this in this funtio

> From your experiance do u think  utilizing webworker to do pixi work is worth?

No, its not worth it. When its actually worth, it doesnt have to do anything with pixi :)

Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...