Fix T101438: Wrong LOD selection after clamping the mip value (Nvidia)

Fix for T101438

Clamping the mip seems to always set it to 9.0.
I couldn't find an alternative way to avoid triggering the error (ie. min(mip, 9.0)).

In any case, the results with this patch applied look the same to the (correct) ones on AMD.
And, since clamping the max mip to a hardcoded value could result in resolution-depended behavior, I guess disabling the clamp should be ok anyway.

Reviewed By: fclem

Maniphest Tasks: T101438

Differential Revision: https://developer.blender.org/D16129
This commit is contained in:
Miguel Pozo 2022-10-04 13:31:59 +02:00 committed by Jeroen Bakker
parent da6d6f99a8
commit 6c2c3ed2c9
Notes: blender-bot 2023-02-14 03:21:27 +01:00
Referenced by issue #101438, Eevee: Screen Space Refraction Artefacts when using low roughness and refraction depth
1 changed files with 4 additions and 1 deletions

View File

@ -79,7 +79,10 @@ vec4 screen_space_refraction(vec3 vP, vec3 N, vec3 V, float ior, float roughness
/* Texel footprint */
vec2 texture_size = vec2(textureSize(refractColorBuffer, 0).xy) / hizUvScale.xy;
float mip = clamp(log2(cone_footprint * max(texture_size.x, texture_size.y)), 0.0, 9.0);
float mip = log2(cone_footprint * max(texture_size.x, texture_size.y));
// Disabled. Causes incorrect LOD sampling on Nvidia cards. (T101438)
// mip = clamp(mip, 0.0, 9.0);
vec3 spec = textureLod(refractColorBuffer, hit_uvs * hizUvScale.xy, mip).xyz;
float mask = screen_border_mask(hit_uvs);