Skip to content

Commit

Permalink
fix Iridescence name (#2489)
Browse files Browse the repository at this point in the history
* fix: iridescence bug
  • Loading branch information
hhhhkrx authored Jan 7, 2025
1 parent ac6f5f5 commit f55f83e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions packages/shader-shaderlab/src/shaders/shadingPBR/BRDF.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ struct SurfaceData{
#endif

#ifdef MATERIAL_ENABLE_IRIDESCENCE
float iridesceceIOR;
float iridesceceFactor;
float iridescenceIOR;
float iridescenceFactor;
float iridescenceThickness;
#endif

Expand Down Expand Up @@ -222,7 +222,7 @@ vec3 BRDF_Specular_GGX(vec3 incidentDirection, SurfaceData surfaceData, BRDFData

vec3 F = F_Schlick( specularColor, dotLH );
#ifdef MATERIAL_ENABLE_IRIDESCENCE
F = mix(F, brdfData.iridescenceSpecularColor, surfaceData.iridesceceFactor);
F = mix(F, brdfData.iridescenceSpecularColor, surfaceData.iridescenceFactor);
#endif


Expand Down Expand Up @@ -404,7 +404,7 @@ void initBRDFData(SurfaceData surfaceData, out BRDFData brdfData){

#ifdef MATERIAL_ENABLE_IRIDESCENCE
float topIOR = 1.0;
brdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridesceceIOR, brdfData.specularColor, surfaceData.iridescenceThickness);
brdfData.iridescenceSpecularColor = evalIridescenceSpecular(topIOR, surfaceData.dotNV, surfaceData.iridescenceIOR, brdfData.specularColor, surfaceData.iridescenceThickness);
#endif

#ifdef MATERIAL_ENABLE_SHEEN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ SurfaceData getSurfaceData(Varyings v, vec2 aoUV, bool isFrontFacing){

//Iridescence
#ifdef MATERIAL_ENABLE_IRIDESCENCE
surfaceData.iridesceceFactor = material_IridescenceInfo.x;
surfaceData.iridesceceIOR = material_IridescenceInfo.y;
surfaceData.iridescenceFactor = material_IridescenceInfo.x;
surfaceData.iridescenceIOR = material_IridescenceInfo.y;

#ifdef MATERIAL_HAS_IRIDESCENCE_THICKNESS_TEXTURE
float iridescenceThicknessWeight = texture2D( material_IridescenceThicknessTexture, uv).g;
Expand All @@ -289,7 +289,7 @@ SurfaceData getSurfaceData(Varyings v, vec2 aoUV, bool isFrontFacing){
#endif

#ifdef MATERIAL_HAS_IRIDESCENCE_TEXTURE
surfaceData.iridesceceFactor *= texture2D( material_IridescenceTexture, uv).r;
surfaceData.iridescenceFactor *= texture2D( material_IridescenceTexture, uv).r;
#endif
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void evaluateSpecularIBL(Varyings varyings, SurfaceData surfaceData, BRDFData br
vec3 radiance = getLightProbeRadiance(surfaceData, surfaceData.normal, brdfData.roughness);

#ifdef MATERIAL_ENABLE_IRIDESCENCE
vec3 speculaColor = mix(brdfData.specularColor, brdfData.iridescenceSpecularColor, surfaceData.iridesceceFactor);
vec3 speculaColor = mix(brdfData.specularColor, brdfData.iridescenceSpecularColor, surfaceData.iridescenceFactor);
#else
vec3 speculaColor = brdfData.specularColor;
#endif
Expand Down

0 comments on commit f55f83e

Please sign in to comment.