Source SDK 2013: Shader Authoring
Introduction
Shaders are an important part of Source development. They allow you to create and utilize complex graphical effects that would not be possible with art assets alone. This intention of this page will be to serve as both an introduction to and a gateway for shader development using the Source 2013 SDK.
Pre-requisites
In order to avoid cluttering this page with tons of information, this guide assumes you've already checked out the Source 2013 SDK from GitHub. If you haven't, please follow the instructions on the Source SDK 2013 page. This guide will further assume that you've built the SDK successfully before reading this page.
The Source SDK contains a bunch of perl scripts that are run during the shader compile process. Naturally, to run these, you'll need to install ActivePerl. You should grab the 64-bit version from here and install it. When the installation completes, you will need to install the String-CRC32 Perl module using the Perl Package Manager which you can find via the start menu. When both products are installed, open up a command prompt window and type:
perl -v
You should see output similar to the following:
This is perl 5, version 18, subversion 4 (v5.18.4) built for MSWin32-x64-multi-thread (with 1 registered patch, see perl -V for more detail) Copyright 1987-2013, Larry Wall Binary build 1803 [298573] provided by ActiveState http://www.ActiveState.com Built Oct 20 2014 10:19:51 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Setting up the build
Previous versions of the Source SDK used to ship all of the code for the stdshader_dx9 module. This paradigm was abandoned in favor of using a custom game shader module approach. There are number of advantages to this approach. The first advantage is that you no longer have to build all of the base shaders that ship with the Source SDK (such as vertexlitgeneric) which can number in the hundreds of thousands of combos. Your build would be constrained to shaders you've written. The second advantage is that you can override stock SDK shaders with your own as the game shader module is loaded after all of the stdshader_dxX modules.