@@ -41,7 +41,7 @@ float calculateEVSM(vec3 moments, float Z, float vsmBias, float exponent) {
41
41
// ------ VSM 16 ------
42
42
43
43
float VSM16(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {
44
- vec3 moments = texture2D (tex, texCoords).xyz;
44
+ vec3 moments = texture2DLod (tex, texCoords, 0.0 ).xyz;
45
45
return calculateEVSM(moments, Z, vsmBias, exponent);
46
46
}
47
47
@@ -58,18 +58,19 @@ float getShadowSpotVSM16(TEXTURE_ACCEPT(shadowMap), vec3 shadowCoord, vec4 shado
58
58
float VSM32(TEXTURE_ACCEPT(tex), vec2 texCoords, float resolution, float Z, float vsmBias, float exponent) {
59
59
60
60
#ifdef CAPS_TEXTURE_FLOAT_FILTERABLE
61
- vec3 moments = texture2D (tex, texCoords).xyz;
61
+ vec3 moments = texture2DLod (tex, texCoords, 0.0 ).xyz;
62
62
#else
63
63
// manual bilinear filtering
64
64
float pixelSize = 1.0 / resolution;
65
65
texCoords -= vec2(pixelSize);
66
- vec3 s00 = texture2D (tex, texCoords).xyz;
67
- vec3 s10 = texture2D (tex, texCoords + vec2(pixelSize, 0)).xyz;
68
- vec3 s01 = texture2D (tex, texCoords + vec2(0, pixelSize)).xyz;
69
- vec3 s11 = texture2D (tex, texCoords + vec2(pixelSize)).xyz;
66
+ vec3 s00 = texture2DLod (tex, texCoords, 0.0 ).xyz;
67
+ vec3 s10 = texture2DLod (tex, texCoords + vec2(pixelSize, 0), 0.0 ).xyz;
68
+ vec3 s01 = texture2DLod (tex, texCoords + vec2(0, pixelSize), 0.0 ).xyz;
69
+ vec3 s11 = texture2DLod (tex, texCoords + vec2(pixelSize), 0.0 ).xyz;
70
70
vec2 fr = fract(texCoords * resolution);
71
71
vec3 h0 = mix(s00, s10, fr.x);
72
72
vec3 h1 = mix(s01, s11, fr.x);
73
+ vec3 moments = mix(h0, h1, fr.y);
73
74
#endif
74
75
75
76
return calculateEVSM(moments, Z, vsmBias, exponent);
0 commit comments