I have a custom shading in Unreal Engine 4 that I’m trying to make work in Unreal Engine 5.
The model is implemented similarly to these two resources:
The issue I’m having is that in Unreal Engine 5 my material is just black. Looking at the visualization of the shader model ID the system seems to think it’s just unlit material.
On the C-side of the engine things seem ok - I can select my shading model in a material editor and my custom pin names and such all work. But on the shader side the shading model ID doesn’t seem to come through correctly.
If I change the code below to use my shading model it uses my shading math, so that part also works. The issue is just that the shading model ID doesn’t seem to come through correctly.
FDirectLighting IntegrateBxDF( FGBufferData GBuffer, half3 N, half3 V, half3 L, float Falloff, float NoL, FAreaLight AreaLight, FShadowTerms Shadow )
{
return CelShadingBxDF(GBuffer, N, V, L, Falloff, NoL, AreaLight, Shadow);
In EngineTypes.h I have the following:
MSM_Strata UMETA(DisplayName="Strata", Hidden),
//JAMES SEZ our custom cel shading model
MSM_CelShaded UMETA(DisplayName = "Cel Shading"),
/** Number of unique shading models. */
MSM_NUM UMETA(Hidden),
In ShadingCommon.ush I have this:
#define SHADINGMODELID_STRATA 12 // Temporary while we convert everything to Strata
#define SHADINGMODELID_CEL_SHADED 13
#define SHADINGMODELID_NUM 14
Maybe there is some issue with having the custom model after strata?
In BasePassPixelShader if I hardcode the ShadingModelID then objects draw using my shading model math, but the objects actually set to my shading model are still black. So it seems like it’s failing at a very high level.
Any ideas? Maybe having anything after MSM_Strata is bad? (Little scared to change that ordering)
Apologies if this is a very niche topic and not directly relevant to the core UE5 changes.
Update: I tried swapping the ordering of Strata and my custom model and that had no effect.
TL;DR - made a new shading model, working in UE4, in UE5 the shadingmodelID for it is unlit and it seems like BasePassPixelShader isn’t even being used at all for the new model.