Eevee: SSR: Blur Mipmaps more.
Cost is negligeable (Only 0.02 ms more) and it improve stability.
This commit is contained in:
parent
99f37bf2a2
commit
0ab8b93fdd
|
@ -8,8 +8,20 @@ out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
#if 0
|
||||
/* Reconstructing Target uvs like this avoid missing pixels if NPO2 */
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 / vec2(textureSize(source, 0));
|
||||
|
||||
FragColor = textureLod(source, uvs, 0.0);
|
||||
#else
|
||||
vec2 texel_size = 1.0 / vec2(textureSize(source, 0));
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 * texel_size;
|
||||
vec4 ofs = texel_size.xyxy * vec4(0.75, 0.75, -0.75, -0.75);
|
||||
|
||||
FragColor = textureLod(source, uvs + ofs.xy, 0.0);
|
||||
FragColor += textureLod(source, uvs + ofs.xw, 0.0);
|
||||
FragColor += textureLod(source, uvs + ofs.zy, 0.0);
|
||||
FragColor += textureLod(source, uvs + ofs.zw, 0.0);
|
||||
FragColor *= 0.25;
|
||||
#endif
|
||||
}
|
|
@ -12,20 +12,20 @@ out vec4 FragColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
/* Reconstructing Target uvs like this avoid missing pixels */
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 / vec2(textureSize(source, 0).xy);
|
||||
#if 0
|
||||
/* Reconstructing Target uvs like this avoid missing pixels if NPO2 */
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 / vec2(textureSize(source, 0));
|
||||
|
||||
#if 0 /* Slower and does not match the main framebuffer downsampling. */
|
||||
/* Downsample with a 4x4 box filter */
|
||||
vec4 d = texelSize.xyxy * vec4(-1, -1, +1, +1);
|
||||
FragColor = textureLod(source, vec3(uvs, layer), 0.0);
|
||||
#else
|
||||
vec2 texel_size = 1.0 / vec2(textureSize(source, 0));
|
||||
vec2 uvs = gl_FragCoord.xy * 2.0 * texel_size;
|
||||
vec4 ofs = texel_size.xyxy * vec4(0.75, 0.75, -0.75, -0.75);
|
||||
|
||||
FragColor = texture(source, vec3(uvs + d.xy, layer)).rgba;
|
||||
FragColor += texture(source, vec3(uvs + d.zy, layer)).rgba;
|
||||
FragColor += texture(source, vec3(uvs + d.xw, layer)).rgba;
|
||||
FragColor += texture(source, vec3(uvs + d.zw, layer)).rgba;
|
||||
|
||||
FragColor /= 4.0;
|
||||
FragColor = textureLod(source, vec3(uvs + ofs.xy, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.xw, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zy, layer), 0.0);
|
||||
FragColor += textureLod(source, vec3(uvs + ofs.zw, layer), 0.0);
|
||||
FragColor *= 0.25;
|
||||
#endif
|
||||
|
||||
FragColor = texture(source, vec3(uvs, layer));
|
||||
}
|
Loading…
Reference in New Issue