Shader authoring/Compiling Shaders: Difference between revisions
Jump to navigation
Jump to search
Note: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
Note:Shader names should adhere to the same convention as the sample ones distributed in the SDK (e.g.
(Corrected example) |
(cleanup) |
||
| Line 1: | Line 1: | ||
{{shadertut}} | {{shadertut}} | ||
[[ | To compile .[[FXC]] files, list them in a text file (one per line), then run <code>src\materialsystem\stdshaders\buildsdkshaders.bat</code> 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 <code>buildsdkshaders.bat</code> command line is: | ||
buildsdkshaders.bat [text filename] -game [mod directory] -source [source directory] | |||
Example: | |||
buildsdkshaders.bat MyShaders -game "C:\Steam\SteamApps\SourceMods\MyMod" -source "C:\MyMod\Src" | |||
buildsdkshaders.bat | |||
{{note|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 <code>buildsdkshaders.bat</code>. | |||
< | Before building your shader DLL, you need to run <code>buildsdkshaders.bat</code>, so it can generate include files that your shader DLL will need.}} | ||
buildsdkshaders.bat | |||
</ | |||
Refer to <code>stdshaders_dx8.txt</code> and <code>stdshaders_dx9.txt</code> as examples of how to set up your shaders text file. All the source code for the shader DLL should be in the same directory as the .FXC, .[[VSH]], and .[[PSH]] files. After <code>buildsdkshaders.bat</code> runs, you can look in the <code>fxctmp9</code> sub-directory to see the include files generated by the shader compiler. | |||
{{note|Shader names should adhere to the same convention as the sample ones distributed in the SDK (e.g. <code>*_ps20.fxc</code> for pixel shaders conforming to the 2.0 spec, <code>*_vs11.fxc</code> for vertex shaders conforming to the 1.1 spec.)}} | |||
[[Category:Shaders]] | |||
Revision as of 06:04, 20 January 2007
To compile .FXC files, list them in a text file (one per line), then run src\materialsystem\stdshaders\buildsdkshaders.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 buildsdkshaders.bat command line is:
buildsdkshaders.bat [text filename] -game [mod directory] -source [source directory]
Example:
buildsdkshaders.bat MyShaders -game "C:\Steam\SteamApps\SourceMods\MyMod" -source "C:\MyMod\Src"
buildsdkshaders.bat.
Before building your shader DLL, you need to run buildsdkshaders.bat, so it can generate include files that your shader DLL will need.Refer to stdshaders_dx8.txt and stdshaders_dx9.txt as examples of how to set up your shaders text file. All the source code for the shader DLL should be in the same directory as the .FXC, .VSH, and .PSH files. After buildsdkshaders.bat runs, you can look in the fxctmp9 sub-directory to see the include files generated by the shader compiler.
*_ps20.fxc for pixel shaders conforming to the 2.0 spec, *_vs11.fxc for vertex shaders conforming to the 1.1 spec.)