Hardcoded #include replacements in PBRCustomMaterial constructor

Happy weekend!

I have a question about PBRCustomMaterial implementation. Why does the constructor has 3 statements to explicitly replace shader includes? PBR shader contains many includes, why these specific 3 only? Can’t these includes be replaced centrally by ShaderProcessor._ProcessIncludes?

These includes are explicitely replaced by their code because they contain some #define CUSTOM_XXX declarations and the PBRCustomMaterial class requires that these defines are in the main shader code flow to be able to replace them by your custom code.

1 Like

Thanks @Evgeni_Popov. Now I got it. All the CUSTOM_XXX defines are replaced in the customShaderNameResolve implementation within PBRCustomMaterial.