H3 shader compiling
Halo 3 has a flexible shader system based on automatically generated templates. Usually as a map maker you can ignore the technical details of it.
In Halo 2 there was a limited number of templates with each one being handwritten by a graphics programmer, Halo 3 moved away from this and now has a more flexible shader system based on render method definitions. Each definition contains categories and each category contains one or more options. The option selected for each category uniquely identifies a shader template. A template will only be generated if its combination of options is used in a shader - generating all templates including ones that will never be used would waste disk space and time.
Tool when patched will compile any new templates when needed, as will Sapien but this can be slow and can increase the load time for a level with a lot of custom templates. It will also cause issues for anyone writing their own render method definitions or modifying existing ones. To solve this issue you can periodically regenerate the shader templates so all the templates you used are cached on-disk and don't need to be recompiled every time you use them.
- Open a command line in the H3EK directory.
tool dump-render-method-options- this will loop through all the shader tag files and record what templates they use. Wait for the command to complete.
tool generate-templates win shaders\<shader-tag-type>for all shader types you want to regenerate. You can see a full list of shader types and how many templates exist for each in the output of the previous command but for typical shader usage re-generating
shaders\decalshould be sufficient.
- Sit back and wait, if you have enough cores you might want to run the commands to re-generate each type of shader in parallel. Shader template generation should be done in ~30-60 minutes.
The latest H3EK update fixed most shader compiler issues but a few old commands might still require the shader compiler fix. These commands are for the most part not useful for modders. Installation steps
pc_shader_compiler_imp.dll. Do not use another name or put the file in a different directory.
pc_shader_compiler.dllfrom Github releases
- Place the newly downloaded
- You should have both a
<H3EK>\bin\x64, both files are required as the community fix can't compile any shaders on its own and as such it requires a copy of the stock DLL.
Thanks to the following individuals for their research or contributions to this topic:
- num0005 (Writing this page.)