Description

The results of Roughness=1.0 from a constant and from a parameter are different on 4.20.

The static bool switch of the following material always returns 1.0. But the results are different.
[Link Removed]

[Link Removed]

From 4.20, Statically constant 1.0 roughness is compiled as a "Fully Rough" material. But if the roughness value can't be decided at material compiling time, it isn't compiled as a "Fully Rough". As a result, generated shader codes are different. "Fully Rough" sets FORCE_FULLY_ROUGH to 1.

(BasePassPixelShader.usf)

    #if FORCE_FULLY_ROUGH
		// Factors derived from EnvBRDFApprox( SpecularColor, 1, 1 ) == SpecularColor * 0.4524 - 0.0024
		GBuffer.DiffuseColor += GBuffer.SpecularColor * 0.45;
		GBuffer.SpecularColor = 0;
		GBuffer.Roughness = 1;
	#endif

This happens from 4.20. Because the following code was added to 4.20 from Fortnite(CL:3883284).

// Fully rough if we have a roughness code chunk and it's constant and evaluates to 1.
bIsFullyRough = Chunk[MP_Roughness] != INDEX_NONE && IsMaterialPropertyUsed(MP_Roughness, Chunk[MP_Roughness], FLinearColor(1, 0, 0, 0), 1) == false;

I think the results shouldn't be different so I report this as a bug and attached a repro project.

Steps to Reproduce
  1. Open the attached project.
  2. Build light
  3. You can see two planes are lit differently even they have the same roughness (1.0).

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-63635 in the post.

4
Login to Vote

Backlogged
ComponentUE - Graphics Features
Affects Versions4.205.1
CreatedSep 4, 2018
ResolvedJun 8, 2022
UpdatedDec 2, 2022
View Jira Issue