If You're Going To Learn By Doing, Make Sure You Have Good Toys

Earlier this year, I faced the daunting task of learning how to code vertex and pixel shaders, the programs that run on your graphics card and produce most of the modern visual effects you see in games and even desktop composition. Unlike languages such as C# or JavaScript, which have helpful tools everywhere you look, there's no One True Way for programming and testing shaders, other than by using them... and then staring in confusion when the red thing is purple and inside out.

Fortunately, the visual nature of shaders has given rise to various "toys" you can use to quickly see what they're doing.

The appropriately named "Shadertoy" is a good example: it's an online tool that lets you write GLSL — OpenGL's flavour of shader language — directly into your browser, which is then rendered using WebGL. Shadertoy also has a repository of shaders, so if you're looking for a specific effect, you can learn how someone else has done it and build on their efforts.

In my case, I had to become familiar with Microsoft's shader language, HLSL. My playground was Unity, a development environment and engine designed for building games. It follows the traditional material workflow you see in 3D modelling packages, where you can combine textures, variables and a shader into a "skin", and apply that to a mesh. This made it easy for me to try things out and see the results immediately.

It's not just shaders where this approach can help. Sites such as W3Schools offer interactive pages for trying out HTML, CSS and JavaScript, while modern browsers let you peer inside any website and play around with elements and styling, with the changes appearing immediately.

Bret Victor, a former Apple UI designer who came up with the initial interface concepts for the iPad, shows the benefits of this "instant" approach in the following talk:

Any programmer would grimace at the thought of the time they've lost waiting for something to compile and will do anything they can to speed up the process. It makes sense to apply this logic to learning and trying out new things.

If failing faster is the way to success, then make sure the tools you're self-educating with let you do that!


Comments

Be the first to comment on this story!

Trending Stories Right Now