I’m working on a custom shading model, but have been stuck for a while trying to access a value that is defined in C++ from my usf shader code.
I based my implementation on the various values in the Translucency Self Shadowing category of a material as they function in a similar fashion. Each of these has a GetMaterial* function in MaterialTemplate.usf. This function is then used to read the value in the actual shader code.
However when I try to do the same thing I get the following error:
Engine/Shaders/ToonShading.usf(12,20): Shader FPostProcessLpvIndirectPS, VF None: error X3004: undeclared identifier 'GetMaterialToonSmoothing'
Replacing my get function with one of the ones I based my implementation on gives the same result:
Engine/Shaders/ToonShading.usf(12,20): Shader FPostProcessLpvIndirectPS, VF None: error X3004: undeclared identifier 'GetMaterialTranslucencyDirectionalLightingIntensity'
Which seems to indicate I am simply missing an #include. However, I can’t seem to find what I need to include. Directly including MaterialTemplate.usf doesn’t work (and isn’t done in any of the other usf’s that do work) and just randomly trying others either has no effect or causes the following error:
error: Can't open include file "Material.usf" #include "Material.usf"
I have the feeling I’m overlooking something really simple and obvious, but I have been staring at it way too long to find it, so any help would be really appreciated.
Something else odd that might be related: The engine seems to be able to compile a number of other shaders just fine before failing on the LPV post process shader in the above errors. Neither those other shaders, nor this one should even use my custom shading model, so it seems strange that some compile fine while this shader is always the one where compilation fails.