Tutorial #2: An introduction to shaders in Unity 3D

Welcome to my second Unity tutorial. This time I'll be walking you through the basics of shaders.

Simply put, a shader is a set of instructions the graphics card processes in order to tweak the surface appearance of an object. In more detail, some of the variables it takes into account are your diffuse map, light position and colour. If that sounds intimidating, don't be alarmed. My goal is to make this as simple as I possibly can and, to that end, I will not be covering Unity's shader language ('Shaderlab') in this tutorial. Let's work our way up to there slowly whilst ensuring we maintain a solid foundation.

Pictures say more than words, so let's have a look at what shaders can do for your scene.

You can clearly see that although the geometry is very simple, through the use of shaders, we can give the scene an added sense of detail. You need to remember however that shaders do take their toll on the GPU and so you should use them sparingly, that is unless your scene is so well optimized it can handle the performance hit.

If you completed the previous tutorial, you'll have become familiar with lightmaps, which are also a type of shader. Thankfully, the script took care of adding the materials to all the objects for us. So while it was useful, we didn't learn as much as we could have.

Hopefully, by the end of this tutorial, you'll have gained the confidence to regularly use bump and cube maps.

With that having been said, let's move on to the next page for an explanation of bump and cube maps.

Pages: 1· 2· 3· 4· 5

1 comment
Comment from: nike air max 2011 ·

Hi,thanks for your blog

12/09/11 @ 20:01