diff options
author | Alexander Court <admin@alexandercourt.de> | 2019-02-18 15:52:25 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-02-18 16:05:16 +0300 |
commit | 253ff57617a90537b334449ad992c7ef13f997ea (patch) | |
tree | 89dbed6766e2db983f5dfd5110f95b2f2fac5157 /source/blender/gpu | |
parent | 6e72601b905dc3df7a3890daad21c24411d63132 (diff) |
Clamp value in sheen calculation to fix fireflies.
Fixes T59784.
Reviewers: fclem
Reviewed By: fclem
Subscribers: brecht
Maniphest Tasks: T59784
Differential Revision: https://developer.blender.org/D4269
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index fc7878dc6ab..a7231bda263 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1089,6 +1089,8 @@ void convert_metallic_to_specular_tinted( vec3 principled_sheen(float NV, vec3 basecol_tint, float sheen_tint) { float f = 1.0 - NV; + /* Temporary fix for T59784. Normal map seems to contain NaNs for tangent space normal maps, therefore we need to clamp value. */ + f = clamp(f, 0.0, 1.0); /* Empirical approximation (manual curve fitting). Can be refined. */ float sheen = f*f*f*0.077 + f*0.01 + 0.00026; return sheen * mix(vec3(1.0), basecol_tint, sheen_tint); |