Skip to content

Commit

Permalink
fix: sheenDFG name
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhhkrx committed Dec 12, 2024
1 parent c7d37fe commit 27cedec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/shaderlab/src/shaders/shadingPBR/BRDF.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ struct BRDFData{
#ifdef MATERIAL_ENABLE_SHEEN
float sheenPerceptualRoughness;
float sheenScaling;
float iblSheenDFG;
float approxIBLSheenDG;
#endif

};
Expand Down Expand Up @@ -344,7 +344,7 @@ vec3 BRDF_Diffuse_Lambert(vec3 diffuseColor) {
// This is a curve-fit approxmation to the "Charlie sheen" BRDF integrated over the hemisphere from
// Estevez and Kulla 2017, "Production Friendly Microfacet Sheen BRDF". The analysis can be found
// in the Sheen section of https://drive.google.com/file/d/1T0D1VSyR4AllqIJTQAraEIzjlb5h4FKH/view?usp=sharing
float iblSheenDFG(SurfaceData surfaceData, float sheenRoughness) {
float approxIBLSheenDG(SurfaceData surfaceData, float sheenRoughness) {
float dotNV = surfaceData.dotNV;
float a = sheenRoughness < 0.25 ? -339.2 * sheenRoughness + 161.4 * sheenRoughness - 25.9 : -8.48 * sheenRoughness + 14.3 * sheenRoughness - 9.95;
float b = sheenRoughness < 0.25 ? 44.0 * sheenRoughness - 23.7 * sheenRoughness + 3.26 : 1.97 * sheenRoughness - 3.27 * sheenRoughness + 0.72;
Expand Down Expand Up @@ -402,8 +402,8 @@ void initBRDFData(SurfaceData surfaceData, out BRDFData brdfData){
#ifdef MATERIAL_ENABLE_SHEEN
float sheenRoughness = max(MIN_PERCEPTUAL_ROUGHNESS, min(surfaceData.sheenRoughness + getAARoughnessFactor(surfaceData.normal), 1.0));
brdfData.sheenPerceptualRoughness = pow2(sheenRoughness);
brdfData.iblSheenDFG = iblSheenDFG(surfaceData, brdfData.sheenPerceptualRoughness);
brdfData.sheenScaling = 1.0 - brdfData.iblSheenDFG * max(max(surfaceData.sheenColor.r, surfaceData.sheenColor.g), surfaceData.sheenColor.b);
brdfData. approxIBLSheenDG = approxIBLSheenDG(surfaceData, brdfData.sheenPerceptualRoughness);
brdfData.sheenScaling = 1.0 - brdfData. approxIBLSheenDG * max(max(surfaceData.sheenColor.r, surfaceData.sheenColor.g), surfaceData.sheenColor.b);
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void evaluateSheenIBL(Varyings varyings, SurfaceData surfaceData, BRDFData brdfD
diffuseColor *= brdfData.sheenScaling;
specularColor *= brdfData.sheenScaling;

vec3 reflectance = radianceAttenuation * brdfData.iblSheenDFG * surfaceData.sheenColor;
vec3 reflectance = radianceAttenuation * brdfData. approxIBLSheenDG * surfaceData.sheenColor;
specularColor += reflectance;
#endif
}
Expand Down

0 comments on commit 27cedec

Please sign in to comment.