Shader authoring/Compiling Shaders: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
mNo edit summary
Line 1: Line 1:
{{shadertut}}
{{shadertut}}
[[Category:Shaders]]


__TOC__
__TOC__

Revision as of 04:06, 13 August 2006

Compiling .FXC Files

To compile .FXC files, list them in a text file (one per line), then run src\materialsystem\stdshaders\BuildShaders.bat on the text file. It will go process your .FXC code and compile all the combinations into your mod's directory. The syntax of the BuildShaders.bat command line is:

BuildShaders.bat [text filename] -game [mod directory] -source [source directory]

Example:

BuildShaders.bat MyShaders.txt -game C:\Steam\SteamApps\SourceMods\MyMod -source C:\MyMod\Src
Note.pngNote:The text file that lists the .FXC files should be in the same directory as your shader DLL source code, because your shader DLL source code will need to refer to files that are generated by BuildShaders.bat. Before building your shader DLL, you need to run BuildShaders.bat, so it can generate include files that your shader DLL will need.

You can look in src\sdkshaders\build_sample_shaders.bat for an example of how it's setup. sdk_shaders.txt specifies all the .FXC files, all the source code for the shader DLL is in the same directory, and the .INC files are placed in the fxctmp9 directory. After BuildShaders.bat runs, you can look in the fxctmp9 directory to see the include files generated by the shader compiler.

Important note: shader have to be named something like for example xxxxxxxx_ps20.fxc or xxxxxxxxx_ps11.fxc