Skip to content

Commit

Permalink
fix: sheen
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhhkrx committed Dec 12, 2024
1 parent 8650e81 commit 17ccc8e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/shaderlab/src/shaders/PBR.gs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ Shader "PBR.gs" {
}

Header("Sheen"){
UI_SheenIntensity("Intensity", Range(0, 1, 0.01)) = 0;
UI_SheenColor("Color", Color ) = (0, 0, 0, 0);
ui_SheenIntensity("Intensity", Range(0, 1, 0.01)) = 0;
ui_SheenColor("Color", Color ) = (0, 0, 0, 0);
material_SheenRoughness("Roughness", Range(0, 1, 0.01)) = 0;
material_SheenTexture("ColorTexture", Texture2D);
material_SheenRoughnessTexture("RoughnessTexture", Texture2D);
Expand Down
6 changes: 3 additions & 3 deletions packages/shaderlab/src/shaders/shadingPBR/BRDF.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ struct BRDFData{
#endif

#ifdef MATERIAL_ENABLE_SHEEN
float sheenRoughness;
float sheenPerceptualRoughness;
float sheenScaling;
float iblSheenDFG;
#endif
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.sheenRoughness = pow2(sheenRoughness);
brdfData.iblSheenDFG = iblSheenDFG(surfaceData, brdfData.sheenRoughness);
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);
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void sheenLobe(Varyings varyings, SurfaceData surfaceData, BRDFData brdfData, ve
diffuseColor *= brdfData.sheenScaling;
specularColor *= brdfData.sheenScaling;

specularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, brdfData.sheenRoughness);
specularColor += attenuationIrradiance * sheenBRDF(incidentDirection, surfaceData, surfaceData.sheenColor, brdfData.sheenPerceptualRoughness);
#endif
}

Expand Down

0 comments on commit 17ccc8e

Please sign in to comment.