Jump to content

RenderTexture performance issues


gulio
 Share

Recommended Posts

Hi there, I'm working on creating a casino slot game which has a lot of reels. The reels themselves are very heavy so I'm using a renderTexture for each reel to optimize. It helps a lot, but up to a point - when the renderTextures are more than 25ish fps goes from ~55 to ~25. I've only seen discussions that include culling as a method for optimizing but thats not an option for me as all renderTextures are visible at all times, so there's nothing to cull. The textures themselves are not too small, but it's the smallest they can be - exactly the size of the thing they are rendering.

Issues occur on an Iphone13 so I can't imagine what would happen on a lower-end device.


Here's how I'm using it:
The reel is passed as a source and a renderTexture is created from it, the reel itself is then not rendered anymore.

 

const createRt = (source, width = source.width, height = source.height) => {
  const texture = RenderTexture.create({ width, height });

  if (RENDERER.mask) {
    RENDERER.mask.enableScissor = true;
  }

  const updater = () => RENDERER.render(source, { renderTexture: texture });

  CombinedTicker.Ticker.add(updater);

  const sprite = new Sprite(texture);

  return sprite;
};
Edited by gulio
Link to comment
Share on other sites

  • 2 weeks later...

SOLUTION:

Checking if the source is visible when attaching the ticker updater got the fps up by ~20.
 

const createRt = (source, width = source.width, height = source.height) => {
  const texture = RenderTexture.create({ width, height });

  if (RENDERER.mask) {
    RENDERER.mask.enableScissor = true;
  }

  const updater = () => source.visible && RENDERER.render(source, { renderTexture: texture });

  CombinedTicker.Ticker.add(updater);

  const sprite = new Sprite(texture);

  return sprite;
};
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.

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...
 Share

  • Recently Browsing   0 members

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