Jump to content

How to apply a shader (not a filter)


lasertown
 Share

Recommended Posts

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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