Shaders in Armory


Hi !
I’d like to use Armory to practice writing shaders (like with GLSL or Cg). Does anyone know if it is possible ?

Thanks !


It is definitely possible, and relatively easy on top of that (depending on the perspective of course) - Lubos made a nice guide not too long ago: - I think it’s primarily GLSL

Feel free to ask if you want some more specific help :slight_smile:


Hey ! Thanks for your answer !

Could you explain a bit more the process in the Lubos guide ? And also, do you know some resources to learn more about writing shaders ?

Thanks a lot !


Hi Mounsif,

The guide describes the process involved in adding shaders as passes through the renderpath. Say if you want to make your own bloom algorithm, or try to implement your own GI technique or whatever.

For a lot of stuff, you don’t actually need to add your own pass, but can just implement stuff in the compositor. The easiest way to start messing around with GLSL is adding code through the compositor (found in Armory > armsdk > armory > Shaders > compositor_pass > compositor_pass.frag.glsl). Here you can add your code directly at the bottom as (which will give you completely red screen):

//This is below all the code that is earlier in the file

vec3 myFunnyColorThatIWantOnMyScreen = vec3(1,0,0); //Red
fragColor.rgb = myFunnyColorThatIWantOnMyScreen;

} //Remember your code needs to be before the last bracket

And from there, it’s basically just to start playing around with the code. If you want to make your own shaders on objects (say you want to make a fire shader), then you can create a custom geometry material pass, which is also described in the guide.

In terms of resources for learning to write shaders, I can only recommend looking into Kha first (the tech powering Iron and Armory), that will give you a good foundation of how things work in general and also how to use GLSL to do various stuff. Also for this, Lubos have written some excellent Kha tutorials.

The Khronos Group’s OpenGL Shader Language reference/docs are always nice to have at hand as well.


For the Kha/GLSL tutorials you can also start tinkering straight in the browser without setting up anything. :slight_smile:


Thanks to all of you for your answers !


Hi!! I tried to use the grass shader from the celshade forest example and it worked. But is there a way to write a new grass wind shader like a simple wind shader? I dont know if I can use the shader for Public games and i have a grass model ( a few planes that stick together ) and when i apply the shader to the model, my texture is blury or green I dont know.


Shader for wind is right there in the cel-shading example(It is in Vertex shader) !: