Saltallica Posted October 20, 2018 Share Posted October 20, 2018 Hey Guys, Running in to a scenario where I'm using an expensive shader applied to a large background sprite. The background doesn't get updated once the shader is applied, and it would be great if I could just get a copy of the sprite as it looks with the shader applied, without it having to re apply the shader every frame. My failed attempts so far: The most straight forward approach was to attempt using cacheAsBitmap, but it simply makes the entire contents of the container disappear. I also tried rendering the sprite (with filter) to a renderTexture, then outputting that to a sprite. The sprite shows up, but the affects of the filter do not show up. Does anyone have any tricks up their sleeves? Thanks! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 20, 2018 Share Posted October 20, 2018 >I also tried rendering the sprite (with filter) to a renderTexture, then outputting that to a sprite. The sprite shows up, but the affects of the filter do not show up. Put that sprite into container, and cache container. Sometimes filters dont work directly.. \Are you using v4 or v5? v5-alpha.3 has a problem with filters in renderTexture Quote Link to comment Share on other sites More sharing options...
Saltallica Posted October 21, 2018 Author Share Posted October 21, 2018 Ivan, Thanks for the quick reply! I'm using v4 (4.6.2). Wrapping the sprite into a container, and applying the filter to either the sprite or the container, with the container.cacheAsBitmap = true causes it to disappear completely. Also tried playing with render.generateTexture and also getting the same results - as in nothing displays. Only other thing I can think to do at this point is extract the image, and re add it as a new texture, but not sure if that'll work either. Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted October 21, 2018 Share Posted October 21, 2018 Please try latest (4.8.2) I have no guarantees about cacheAsBitmap , i manually take bounds and call "renderer.render(mySprite, newRenderTexture)" . There are many issues like yours at https://github.com/pixijs/pixi.js/issues , try search "cacheAsBitmap" 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.