Skip to content

Commit

Permalink
Use Burley diffuse in physically based material
Browse files Browse the repository at this point in the history
  • Loading branch information
szellmann committed May 11, 2024
1 parent a6215d2 commit 7d523be
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion renderer/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,21 @@ inline float F_Schlick(float u, float f0)
return f0 + (1.f - f0) * pow5(1.f - u);
}

VSNRAY_FUNC
inline float Fd_Lambert()
{
return constants::inv_pi<float>();
}

VSNRAY_FUNC
inline float Fd_Burley(float NdotV, float NdotL, float LdotH, float roughness)
{
float f90 = 0.5f + 2.f * roughness * LdotH * LdotH;
float lightScatter = F_Schlick(NdotL, f90);
float viewScatter = F_Schlick(NdotV, f90);
return lightScatter * viewScatter * constants::inv_pi<float>();
}

VSNRAY_FUNC
inline float D_GGX(float NdotH, float roughness)
{
Expand Down Expand Up @@ -740,7 +755,8 @@ inline vec3 evalPhysicallyBasedMaterial(const dco::Material &mat,
// Metallic materials don't reflect diffusely:
diffuseColor = lerp(diffuseColor, vec3f(0.f), metallic);

vec3 diffuseBRDF = constants::inv_pi<float>() * diffuseColor;
//vec3 diffuseBRDF = diffuseColor * Fd_Lambert();
vec3 diffuseBRDF = diffuseColor * Fd_Burley(NdotV, NdotL, LdotH, alpha);

// GGX microfacet distribution
float D = D_GGX(NdotH, alpha);
Expand Down

0 comments on commit 7d523be

Please sign in to comment.