Incorrect PBR BRDF for mobile platform?

Hi,

Some BRDF calculation seems incorrect in UE5.4(exist in UE5.5 too). It cause specular doesn’t match between mobile and PC. we double check it with UE4.27. F should use F0(SpecularColor) instead of GetEnvBRDF(SpecularColor, Roughness, NoV). It’s a common essential issue, so can you help to verify it?

BTW, After UE5.6, mobile GGX code has been removed, it will cost more ALU and no half precision support. Any plan to further optimize these code?

Best regards,

Jin Yaping

half3 MobileSpecularGGXInner(half D, half3 SpecularColor, half Roughness, half NoV, half NoL, half VoH, bool bHighQualityBRDF)
{
	...
	half3 F = GetEnvBRDF(SpecularColor, Roughness, NoV);
	...
}

[Attachment Removed]

重现步骤
Directly check shader code in ShadingModels.ush

half3 MobileSpecularGGXInner(half D, half3 SpecularColor, half Roughness, half NoV, half NoL, half VoH, bool bHighQualityBRDF)

{

half Vis = (Roughness * 0.25 + 0.25);

half3 F = GetEnvBRDF(SpecularColor, Roughness, NoV);

if (bHighQualityBRDF)

{

Vis = saturate(Vis_SmithJointApprox(Roughness * Roughness * Roughness * Roughness, NoV, NoL));

F = F_Schlick(SpecularColor, VoH);

}

return (D * Vis) * F;

}

[Attachment Removed]

Hi there,

Just to let you know, your observation is correct. We removed the mobile specular shading path because our artists noticed slight discrepancies in the look between the mobile and non-mobile shading paths, leading them to author two materials. Perhaps the mix-up you pointed out with the F0 and GetEnvBRDF was a part of the reason for having different looks. How much of a performance difference did you notice when profiling your project with the new code path? We noticed a slight uptick in texture memory fetches, but not in ALU, which we are ok with.

Cheers,

Tim

[Attachment Removed]

Hi Tim,

Thanks for your reply, we didn’t profile the performance between two cases, but it’s obviously new code run with all full float precision instead of old half precision. As we all know, it will half the performance and double GPU register on mobile platform, so, we want to know if you have any further plan to optimize it later.

Regards,

Jin Yaping

[Attachment Removed]

Hi again Jin,

Yes, in theory, if none of the shader code had been changed between versions, aside from halving the floating-point precision from 32 to 16 bits, then you would be correct in assuming you could get roughly a 2x improvement in register usage and ALU cycles, etc. However, we also changed a lot of other code surrounding our mobile shading models between 5.5 and 5.7, so the answer is not as straightforward. We made the trade-off of higher precision for a slight performance hit, as I explained earlier, and we also ended up removing those functions entirely (MobileSpecularGGXInner and some others). I highly encourage you to profile your project in 5.7 to ensure the performance has actually degraded as much as you think. Once you have some numbers, we can discuss further about ways to optimize your title. If you have any further questions, please let me know.

Cheers,

Tim

[Attachment Removed]

Thanks Tim, we will profile performance if we upgraded engine code. For now, it’s OK to change it to F0. Thanks for your time.

[Attachment Removed]

You are welcome. That does sound like the best way forward. If you have any further questions, reach out again.

[Attachment Removed]