diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-01-11 15:29:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-11 15:29:18 +0100 |
commit | ec7a8e7d63e31cca5472b662170faab7935482f1 (patch) | |
tree | db340a084b3c9917df6d2cad7206fa97529e2ef4 | |
parent | c5b66daec87796f9689a8cce6d1632554913b36c (diff) | |
parent | 252344f706452c36e579118a07bccd2d91afc710 (diff) |
Merge pull request #15594 from AndreaCatania/p4
Fixed graphic artifact caused by anisotropic filter
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 958a166968..d3644bffdd 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -904,7 +904,7 @@ float G_GGX_anisotropic_2cos(float cos_theta_m, float alpha_x, float alpha_y, fl float sin2 = (1.0-cos2); float s_x = alpha_x * cos_phi; float s_y = alpha_y * sin_phi; - return 1.0 / (cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 )); + return 1.0 / max(cos_theta_m + sqrt(cos2 + (s_x*s_x + s_y*s_y)*sin2 ), 0.001); } float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float cos_phi, float sin_phi) { @@ -913,7 +913,7 @@ float D_GGX_anisotropic(float cos_theta_m, float alpha_x, float alpha_y, float c float r_x = cos_phi/alpha_x; float r_y = sin_phi/alpha_y; float d = cos2 + sin2*(r_x * r_x + r_y * r_y); - return 1.0 / (M_PI * alpha_x * alpha_y * d * d ); + return 1.0 / max(M_PI * alpha_x * alpha_y * d * d, 0.001); } |