Jump to content
  • Advertisement
AireSpringfield

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:

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

Share this post


Link to 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


Link to 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


Link to 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.

Share this post


Link to post
Share on other sites

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
×

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!