Download

Material CustomData0 parameter is being clamped to 1

I am trying to add a custom shading model which requires data to be sent from the material pins to the shading code defined in “Engine\Shaders\Private\ShadingModels.ush” and I am trying to use the CustomData0 input pin to do so. The problem I am having is that this value seems to be getting clamped to one even though the slider for the parameter is above this value.

Is this the intended behaviour? If it is how do I send values greater than 1 to my shading model using custom material input pins or otherwise?

I am using version 4.17.1 of the engine.

Reproduction
ShadingModels.ush



float3 Test( FGBufferData GBuffer, float3 LobeRoughness, float3 LobeEnergy, float3 L, float3 V, half3 N )
{
    return Diffuse_Lambert( GBuffer.DiffuseColor ) * GBuffer.CustomData.a;
}

float3 SurfaceShading( FGBufferData GBuffer, float3 LobeRoughness, float3 LobeEnergy, float3 LobeEnergy1, float3 L, float3 V, half3 N, uint2 Random )
{
    ...
    case SHADINGMODELID_CLOTH:
   return ClothShading( GBuffer, LobeRoughness, LobeEnergy, L, V, N );
   return Test( GBuffer, LobeRoughness, LobeEnergy, L, V, N );
    ...
}


ShadingModelsMaterial.ush



void SetGBufferForShadingModel(
    in out FGBufferData GBuffer, 
    in const FMaterialPixelParameters MaterialParameters,
    const float Opacity,
    const half3 BaseColor,
    const half  Metallic,
    const half  Specular,
    const float Roughness,
    const float4 SubsurfaceData)
{
    ...
    #elif MATERIAL_SHADINGMODEL_CLOTH
        ...
    GBuffer.CustomData.a = saturate( GetMaterialCustomData0(MaterialParameters) );    // Cloth
    GBuffer.CustomData.a = GetMaterialCustomData0(MaterialParameters);
        ...
    ...
}


Material setup

I set the colour to (0.5, 0, 0) and when I set the CustomData scalar value to either 1.0 or 2.0 the result is the same.

What I expect is the colour to be (1, 0, 0) when I set CustomData to a value of 2.0

(Expected)

A video showing the problem. As you can see the values only have an effect on the material from 0-1.