How to use shaders?


Hi, I’m trying out Amethyst, and I’d like to use a custom shader to render a model. I read something about needing to create a custom render pass, but I’m not exactly sure how all this fits together. Are there any examples that I could look at that use custom shaders? Thanks!

(Théo Degioanni) #2

The easiest way to have a custom shader currently is a bit dirty but easy enough.

What you need to do is copy an existing pass from the Amethyst source code, (for example DrawFlat, depending on what you want to modify), and replace the shader it uses by yours.

Hope this helps, and please note that in a not-so-distant future shaders will be much much easier to manipulate in Amethyst (work in progress).


Great, that’s exactly what I was looking for. Thank you!

(Andrea Catania) #4

Using a render pass will apply the shader to all the meshes. But if I would like to create a shader for just a particular mesh, how can I do it?