Parameters of physically based Material in UE4?

Started by
3 comments, last by Syntac_ 6 years, 2 months ago

Hi, I'm currently studying physically based shading in UE4 described in Real Shading in Unreal Engine 4

In the notes, the Material has 4 basic properties: BaseColor, Metallic, Roughness and Cavity.

Here is their BRDF model in use:

01.JPG.19f7188a8db962c6425cbc64d67364af.JPG

02.thumb.JPG.820751037f45c6a4f0fce859bd688b89.JPG

The use of roughness is clearly clarified, and I guess BaseColor is referred as \(c_{diff}\)c_diff in the diffuse component. Then  anyone knows how Metallic and Cavity is implemented in UE4? Exact fragments in the source code of the engine would be the best. Thanks a lot!!

Advertisement

You have to compute the diffuse albedo (Cdiff) and specular albedo (F0) from the base color like this:


float3 diffuseAlbedo = lerp(baseColor.xyz, 0.0f, metallic);
float3 specularAlbedo = lerp(0.03f, baseColor.xyz, metallic);

The basic idea is that non-metallics have diffuse lighting, non-colored specular, and a small F0. While metallics have no specular, colored specular, and possibly a much higher F0.

Cavity is usually just multiplied with the final result of the specular term (f(l, v)). It's essentially an occlusion term that represents how much of the specular is blocked by the surface.

19 hours ago, MJP said:

You have to compute the diffuse albedo (Cdiff) and specular albedo (F0) from the base color like this:



float3 diffuseAlbedo = lerp(baseColor.xyz, 0.0f, metallic);
float3 specularAlbedo = lerp(0.03f, baseColor.xyz, metallic);

The basic idea is that non-metallics have diffuse lighting, non-colored specular, and a small F0. While metallics have no specular, colored specular, and possibly a much higher F0.

Cavity is usually just multiplied with the final result of the specular term (f(l, v)). It's essentially an occlusion term that represents how much of the specular is blocked by the surface.

Thanks so much!By the way, Where can I find some references, like the corresponding hlsl codes?

1 hour ago, AireSpringfield said:

Thanks so much!By the way, Where can I find some references, like the corresponding hlsl codes?

Sign in to Epic's UE4 Github repo.

This topic is closed to new replies.

Advertisement