Skip to content

Commit 1d3526a

Browse files
committed
Remove the parts of the CUS shader that seem to be using uninitialized data as part of roughness calculations.
Bump minimum roughness up as a blanket way to avoid bright edge reflections from the ground.
1 parent 146b79d commit 1d3526a

1 file changed

Lines changed: 2 additions & 33 deletions

File tree

ModelMaterials_GL4/templates/cus_gl4.frag.glsl

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ const float EPS = 1e-4;
206206

207207
/***********************************************************************/
208208
// PBR constants
209-
const float MIN_ROUGHNESS = 0.04;
209+
const float MIN_ROUGHNESS = 0.22;
210210
const float DEFAULT_F0 = 0.04;
211211

212212
/***********************************************************************/
@@ -1047,34 +1047,7 @@ void main(void){
10471047
vec3 kD = 1.0 - F;
10481048
kD *= 1.0 - metalness;
10491049

1050-
///
1051-
#if (USE_ENVIRONMENT_DIFFUSE == 1) || (USE_ENVIRONMENT_SPECULAR == 1)
1052-
#if (RENDERING_MODE == 0)
1053-
//TextureEnvBlured(N, Rv, iblDiffuse, iblSpecular); //needed for Intel GPU
1054-
#endif
1055-
#endif
1056-
///
1057-
1058-
#if (USE_ENVIRONMENT_DIFFUSE == 1)
1059-
{
1060-
#if 0
1061-
vec3 iblDiffuseYCbCr = RGB2YCBCR * iblDiffuse;
1062-
float sunAmbientLuma = dot(LUMA, sunAmbientModel.rgb);
1063-
1064-
vec2 sunAmbientLumaLeeway = vec2(pbrParams[5]);
1065-
1066-
iblDiffuseYCbCr.x = smoothclamp(iblDiffuseYCbCr.x,
1067-
(1.0 - sunAmbientLumaLeeway.x) * sunAmbientLuma,
1068-
(1.0 + sunAmbientLumaLeeway.y) * sunAmbientLuma);
1069-
1070-
iblDiffuse = YCBCR2RGB * iblDiffuseYCbCr;
1071-
#else
1072-
iblDiffuse = mix(sunAmbientModel.rgb, iblDiffuse, pbrParams[5]);
1073-
#endif
1074-
}
1075-
#else
1076-
iblDiffuse = sunAmbientModel.rgb;
1077-
#endif
1050+
iblDiffuse = sunAmbientModel.rgb;
10781051

10791052
//vec4 debugColor = vec4(albedoColor.rgb ,1.0);
10801053
vec3 diffuse = iblDiffuse * albedoColor * aoterm_fogFactor_selfIllumMod_healthFraction.x;
@@ -1087,10 +1060,6 @@ void main(void){
10871060
vec3 reflectionColor = vec3(0.0);
10881061
#endif
10891062

1090-
#if (USE_ENVIRONMENT_SPECULAR == 1)
1091-
reflectionColor = mix(reflectionColor, iblSpecular, roughness);
1092-
#endif
1093-
10941063
//vec3 specular = reflectionColor * (F * envBRDF.x + (1.0 - F) * envBRDF.y);
10951064

10961065
// specular ambient occlusion (see Filament)

0 commit comments

Comments
 (0)