What does compiling shaders mean

I stumbled a couple a times across terms like baking down shader networks / “compiling” them. Can somebody explain a little bit about this?
I know that compiling means turning source code to an executable binary, but I am having problems understanding how this is related to dags (e.g. the surface shader has inputs that maps / noise are fed to, would one cache these as images?)

The node graph is just a different way to view code. Under the hood, it creates the shader code someone would write manually.

That then gets compiled in to the specific format expected by each GPU

3 Likes

In addition:
Each version of shader (for specific case of use) called permutation.
UE4* uses Constant folding for optimization of the node graph. Even Time is just a constant variable.
In UE4 static switches are compile stage. Means if you have ONE static switch, you will DOUBLE the amount of permutations for this shader. Half shaders will be compiled for TRUE, half for FALSE.

*I can’t tell anything about other game engines.

1 Like