Game Dev Tip #4: Breathe life into your game with custom shaders and special effects

The standard approach to texturing most objects in most games tends to be to just assign each object to use some combination of diffuse coloring, specularity, normal mapping, transparency, and emission. More advanced physically-based shading techniques are also sometimes used, depending on the needs of each project.

This is all well and good of course, and works fine for many use cases, but sometimes it can get a bit stale. There are a lot more fun and imaginative things that you can do with shaders than just these standard use cases. A shader will let you express any arbitrary visual effect you want. You just need to know how to communicate your intent properly. If you can dream it, you can shade it, pretty much.

Custom shaders are usually constructed by writing code in a specialized computer programming language called a shading language. Two of the most commonly used shading languages are GLSL and HLSL, but some other less widely known shading languages do exist too.

Most shader code executes in parallel, which does require a somewhat different way of thinking than sequential code. This may initially confuse some people, but writing shader code is not really as difficult as many people imagine it to be. Don’t be shy about trying to learn it. Making custom shaders is actually fairly easy once you understand the basic principles involved.

Why restrict yourself to just the basic standardized shading methods that almost everybody uses when you can also create so many other interesting and imaginative effects using custom shaders? Done properly, this can really make a game feel a lot more visually appealing. It helps add personality and flavor.

By mixing in a bunch of custom shaders and special effects, you can dynamically alter the appearance of the objects in your game during play, thereby making those objects feel much more alive and full of energy. For example, you could add glowing lines of light to some walls and then vary their brightness over time etc.

This game dev tip is an excerpt taken from a small book I wrote. You can find more information about the book here on my website.