gulio Posted February 23 Share Posted February 23 (edited) 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 February 23 by gulio Quote Link to comment Share on other sites More sharing options...
gulio Posted March 7 Author Share Posted March 7 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; }; 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.