User:Ging/Sandbox: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{shadertut}} | {{shadertut}} | ||
{{warning|The latest SDK update (August 2006) does not yet include updated shader samples, and therefore some of the information or processes in this document may be inaccurate for the current SDK.}} | |||
=Introduction= | |||
This document describes how to author shaders in the Source SDK, for further information on what a shader is and how they can be used, please see [[Shader]]. | |||
Every material that is used in Source specifies which shader it uses to render itself. The shader contains the logic and equations to take the source artwork and lighting, and produce the final rendered color for every pixel that the shader is used on. | |||
The Source SDK fully supports Microsoft DirectX [[HLSL]] (High Level Shading Language) and shader assembly languages for writing shaders. It is recommended to use HLSL whenever possible and to only write shader assembly as a last resort. | |||
=Getting Started= | |||
There are a number of external tools required to compile shaders for use in the Source SDK, the following sections detail the tools and provides links for download along with brief instructions on installation and usage. | |||
The tools used are Perl, the DirectX SDK and nmake, the following processes, in general, only have to be performed once before the process of compiling shaders can begin. | |||
==Installing Perl and DirectX== | |||
To install Perl, go to the [http://www.perl.com/download.csp#win32 download page] on http://www.perl.com , download, and install Perl - a recommended version of Perl for windows is [http://www.activeperl.com ActivePerl]. | |||
To install the latest DirectX SDK, go to [http://www.microsoft.com/windows/directx Microsoft's DirectX site], download, and install the DirectX SDK. Be sure to get the latest possible version of the SDK, if a previous version is installed, remove it and download a more recent version. | |||
{{note|Just having DirectX 9.x installed is '''not''' sufficient, the <code>DirectX SDK</code> must be installed!}} | |||
==Copying Files== | |||
With Perl and the DirectX SDK installed, copy the required executables so the SDK compilation tools can use them. The table below assumes that Perl has been installed into <code>C:\Perl</code>, DirectX into <code>C:\DXSDK</code>, and that the mod's source code directory is in <code>C:\MyMod\src</code>. | |||
{{note|Replace the following directory names as appropriate.}} | |||
{| | |||
! Source File || Destination Directory | |||
|- | |||
| C:\Perl\bin\perl.exe || C:\MyMod\src\devtools\bin | |||
|- | |||
| C:\Perl\bin\perl58.dll || C:\MyMod\src\devtools\bin | |||
|- | |||
| C:\DXSDK\Utilities\fxc.exe || C:\MyMod\src\dx9sdk\Utilities | |||
|- | |||
| C:\DXSDK\Utilities\psa.exe || C:\MyMod\src\dx9sdk\Utilities | |||
|- | |||
| C:\DXSDK\Utilities\vsa.exe || C:\MyMod\src\dx9sdk\Utilities | |||
|} | |||
==Environment Setup== | |||
<code>nmake.exe</code> from Microsoft Visual Studio .NET 2003 should be in the system path. If it isn't already in the path, run <code>vcvars32.bat</code> (which would be under the VS.NET directory somewhere like <code>C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin</code>). | |||
If VC Vars will not work, copy the <code>nmake.exe</code> file from the above folder to the sdkshaders root (i.e. <code>C:\MyMod\src\sdkshaders</code>). |
Revision as of 03:43, 13 August 2006

Introduction
This document describes how to author shaders in the Source SDK, for further information on what a shader is and how they can be used, please see Shader.
Every material that is used in Source specifies which shader it uses to render itself. The shader contains the logic and equations to take the source artwork and lighting, and produce the final rendered color for every pixel that the shader is used on.
The Source SDK fully supports Microsoft DirectX HLSL (High Level Shading Language) and shader assembly languages for writing shaders. It is recommended to use HLSL whenever possible and to only write shader assembly as a last resort.
Getting Started
There are a number of external tools required to compile shaders for use in the Source SDK, the following sections detail the tools and provides links for download along with brief instructions on installation and usage.
The tools used are Perl, the DirectX SDK and nmake, the following processes, in general, only have to be performed once before the process of compiling shaders can begin.
Installing Perl and DirectX
To install Perl, go to the download page on http://www.perl.com , download, and install Perl - a recommended version of Perl for windows is ActivePerl.
To install the latest DirectX SDK, go to Microsoft's DirectX site, download, and install the DirectX SDK. Be sure to get the latest possible version of the SDK, if a previous version is installed, remove it and download a more recent version.

DirectX SDK
must be installed!Copying Files
With Perl and the DirectX SDK installed, copy the required executables so the SDK compilation tools can use them. The table below assumes that Perl has been installed into C:\Perl
, DirectX into C:\DXSDK
, and that the mod's source code directory is in C:\MyMod\src
.

Source File | Destination Directory |
---|---|
C:\Perl\bin\perl.exe | C:\MyMod\src\devtools\bin |
C:\Perl\bin\perl58.dll | C:\MyMod\src\devtools\bin |
C:\DXSDK\Utilities\fxc.exe | C:\MyMod\src\dx9sdk\Utilities |
C:\DXSDK\Utilities\psa.exe | C:\MyMod\src\dx9sdk\Utilities |
C:\DXSDK\Utilities\vsa.exe | C:\MyMod\src\dx9sdk\Utilities |
Environment Setup
nmake.exe
from Microsoft Visual Studio .NET 2003 should be in the system path. If it isn't already in the path, run vcvars32.bat
(which would be under the VS.NET directory somewhere like C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\bin
).
If VC Vars will not work, copy the nmake.exe
file from the above folder to the sdkshaders root (i.e. C:\MyMod\src\sdkshaders
).