Shader Breakdown Part 1

The first sets of effects to be made are the shaders for all the creatures, in this game there are four elements that represents fire, earth, wind and water, in our game we call it infernal, buried, apex and nautical. It took about three weeks to design and produce them.

below this main part of the shader for the ‘infernal’ element, the starting node is a custom noise sampling sub graph that i made for when i needed to sample two noise samples. Then taking the difference from the two samples then passing the results into a smoothstep with a parameter to control the amount before multiplying the whole thing with a color.

below is the noise sampling sub graph, i made this graph to speed up development time as the shaders for the other three elements in the game is very similar in structure. the reason why it takes in a vector 4 for direction is because in this node it gets split into two vector 2 components.

The directions gets normalized and multiplied by the speed and time before pass it into a tiling and offset node. there is only one value of speed for both that is because these particular effects do not need varying speed between the two noise sample for the final effect i was going for.

back in the main graph the the main sprite texture is sampled and then added with the results of outline sub graph.

the outline graph takes in the alpha of texture along with two colors and amount parameter, speed and power. the results are added with the noise from above passing it into the master node. see below for outline sub graph.

here using a gradient noise scrolling over time it is passed into two color mask nodes to generate the an opposite pattern. this part of graph could be optimized by replacing one of those nodes with a one minus node. to get an inverse of the noise before applying colors and adding them together. the noise is multiplied with the alpha from the sprite texture that gets passed in, the alpha is controlled by a step node. Here it is also passed into a power node to increase the opaque areas of the alpha before subtracting it with the original. the results are clamped and them multiplied an amount value before combined with the noise results.

Leave a comment