Jump to content

Can expensive rendering be separated into its own "Layer"?


Recommended Posts

I am working on a game view that has overlay modal with scrollable container (Parent container with mask and content container with y transforms on scroll).
In general everything works fine, but I notice my phone heating up sometimes when scrolling this view for a while. I am not using any expensive things like antialiasing, however my stage devicePixelRatio is set at 3 (for iphone xs display).

I assume that with every scroll my whole view is being re-rendered, hence causing this heating up? I was wondering if pixi has a mechanism to separate this scroll container onto a separate layer of some sort and not re-render anything else?

The only solution I can come up with atm is to use second pixi stage on a separate canvas perhaps, but wanted to check here first just in case there is a more elegant solution.

Link to comment
Share on other sites

yes. but there's no special thing that tracks whether that layer was changed and has to be recalculated. 

there's only middle-level stuff: renderTextures, filters. I made automatical caching for filtered/scrolled/masked containers in my app, but it took A LOT of me. its really hard to track all changes without performance loss or bugs

Edited by ivan.popelyshev
Link to comment
Share on other sites

You have basically two options.

1. Render the expensive stuff into a separate rendertexture and use that as you would any other sprite. Rerender the rt when things change.

2. Use two canvases. Update the expensive canvas only when needed.

[Edit] For 1 you can use cacheAsBitmap = true to create rt of a container and use that instead of the whole render list. Though I'd suggest using a custom handling with own RT to handle this as debugging cacheAsBitmap can be a nightmare if there's some errors.

Edited by Exca
Link to comment
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.

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.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...