Merge pull request #69522 from clayjohn/IBL-black-metal
Allow black metallic materials to reflect IBL
This commit is contained in:
commit
daf168f4c8
4 changed files with 4 additions and 4 deletions
|
@ -1162,7 +1162,7 @@ void main() {
|
||||||
|
|
||||||
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
||||||
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
||||||
specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, 0.0, 1.0);
|
specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1485,7 +1485,7 @@ void fragment_shader(in SceneData scene_data) {
|
||||||
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
||||||
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
||||||
|
|
||||||
specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, 0.0, 1.0);
|
specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1205,7 +1205,7 @@ void main() {
|
||||||
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
float a004 = min(r.x * r.x, exp2(-9.28 * ndotv)) * r.x + r.y;
|
||||||
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
vec2 env = vec2(-1.04, 1.04) * a004 + r.zw;
|
||||||
|
|
||||||
specular_light *= env.x * f0 + env.y;
|
specular_light *= env.x * f0 + env.y * clamp(50.0 * f0.g, metallic, 1.0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ void light_compute(vec3 N, vec3 L, vec3 V, float A, vec3 light_color, float atte
|
||||||
float cLdotH5 = SchlickFresnel(cLdotH);
|
float cLdotH5 = SchlickFresnel(cLdotH);
|
||||||
// Calculate Fresnel using specular occlusion term from Filament:
|
// Calculate Fresnel using specular occlusion term from Filament:
|
||||||
// https://google.github.io/filament/Filament.html#lighting/occlusion/specularocclusion
|
// https://google.github.io/filament/Filament.html#lighting/occlusion/specularocclusion
|
||||||
float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), 0.0, 1.0);
|
float f90 = clamp(dot(f0, vec3(50.0 * 0.33)), metallic, 1.0);
|
||||||
vec3 F = f0 + (f90 - f0) * cLdotH5;
|
vec3 F = f0 + (f90 - f0) * cLdotH5;
|
||||||
|
|
||||||
vec3 specular_brdf_NL = cNdotL * D * F * G;
|
vec3 specular_brdf_NL = cNdotL * D * F * G;
|
||||||
|
|
Loading…
Reference in a new issue