lasertown Posted January 9, 2020 Share Posted January 9, 2020 I understand the difference between filters/shaders in pixi, but how does one actually apply a custom shader in v5? I'm assuming filters have more overhead than using raw shaders (from everything I've read) so I'd like to use shaders for simple effects. Assigning the shader property of a sprite to a valid program doesn't seem to do anything. Thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 9, 2020 Share Posted January 9, 2020 Please read other filter-related threads in this subforum. In last few threads I mentioned that there are two ways to do shaders. look for "mesh-and-shaders" in pixijs examples. Quote Link to comment Share on other sites More sharing options...
lasertown Posted January 9, 2020 Author Share Posted January 9, 2020 Apologies, I assure you I did look through what I could find before posting. I had seen the mesh-and-shaders example, but this shows a Mesh using a constructor which accepts a shader. Sprite does not have a constructor like this. But the Sprite documentation shows a 'shader' property which can either be a Filter or a Shader, but setting this property appears not to have any effect. So my question is, is it possible to apply a shader to a Sprite object? Or do I need to instead create a textured mesh if I want to apply a customer shader (not filter) to a display object? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted January 9, 2020 Share Posted January 9, 2020 Mesh/Graphics have two modes - renderDefault (custom shader) and renderBatched. Sprite have only batched mode, it means it needs extra class to care about queue's. There is example how to do that but its not easy to find : https://www.pixiplayground.com/#/edit/~tlXTadqt1qCEvHf~cMQE If you specify "pluginName" it works for both Sprite and Graphics. I'm sorry that I can't give more right now, usually i put 3-4 paragraphs about that stuff, but now I'm just tired and I recommend to look in Mesh, Sprite and Graphics sources to see those "default" and "batched" modes. Quote Link to comment Share on other sites More sharing options...
lasertown Posted January 9, 2020 Author Share Posted January 9, 2020 Thanks, I'll take a look. 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.