Shaders, this is a word I have heard a lot of before and knew how interested many people in the game development community are. And it was my chance to dive into it and hopefully start working on some shaders that I could implement in the game, specifically for the crystals that are decorating the map. Shader is taken from the act of shading when drawing. Which is used to recreate things like depth, texture, its reaction to light, etc. this allows an artist to use the same drawing and apply different shading techniques to it and they result in different looking objects. In the programming world shader is similar to shading in drawing but there is so much more that can be done. In graphics a shader is responsible for the shading process of 3d objects. By writing and creating the code for a shader it manipulates the effect it has on different materials.
Shaders require a material, which can be seen as the skin of an object. This skin is then passed through a shader to create the final look. The undertaking of writing a shader is no easy task and even then some shaders are written in CG/ HLSL. Typically shaders are an extra to the game to give objects that extra visual impact. With things like creating shaders for water, reflective and metallic like surfaces a lot goes into creating a shader in order to create the desired effect. There are multiple types of shaders but the main ones are vertex shader, where it is dependent on all the vertices, geometry shader which is relative to the polygons the GPU will render and finally the pixel shader which can be the most intensive as it works for every pixel. Some other shaders are tessellation shaders and surface shaders.
Unity now allows you to create shaders in C# and then translates them to the appropriate language for the GPU. And some of the effects shaders can make can greatly improve a game visually and in some cases improve performance by avoiding the need to add so many details into a polygon, when a vertex shader can distort and transform these vertices.
To conclude shaders can be a great way to alter the look of your game, and combined with lighting can produce some really incredible results. But it is important to note that written a complex shader is not an easy undertaking. Hopefully I will be able to create my own shader and incorporate it in some capacity with the game, but I definitely need more time with understanding how I should go about writing a shader.
Leave a comment