# Parameters of physically based Material in UE4?

## Recommended Posts

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:

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!!

##### Share on other sites

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.

##### Share on other sites
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?

##### Share on other sites
1 hour ago, AireSpringfield said:

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

## Create an account

Register a new account

1. 1
Rutin
67
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633417
• Total Posts
3011781
• ### Who's Online (See full list)

There are no registered users currently online

×