Jump to content
• Advertisement

# 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 this post

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

#### Share this post

##### 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 this post

##### 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?

Sign in to Epic's UE4 Github repo.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
17
5. 5
• Advertisement

• 9
• 33
• 13
• 13
• 10
• ### Forum Statistics

• Total Topics
632580
• Total Posts
3007191

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!