diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-01 19:07:19 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-01 23:08:36 +0300 |
commit | 4510f30026da8eb090062687f386b9e3a7cf3fa3 (patch) | |
tree | 33ef904a1f614f71d797aca3d07167f7335cf4ac /source | |
parent | c6f55fb0db126281309a2082abf2f480a4671dc5 (diff) |
GPUMaterial: Fix nearest sampling
texelFetch return vec4(0.0) if the target pixel is outside the texture
rect. So we mimic the default repeate mode that we have for linear
interpolation.
Fix T56156 Mapping-Node doesn't work
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 464851bae21..8cc603696df 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -1809,7 +1809,7 @@ void node_tex_image_linear(vec3 co, sampler2D ima, out vec4 color, out float alp void node_tex_image_nearest(vec3 co, sampler2D ima, out vec4 color, out float alpha) { - ivec2 pix = ivec2(co.xy * textureSize(ima, 0).xy); + ivec2 pix = ivec2(fract(co.xy) * textureSize(ima, 0).xy); color = texelFetch(ima, pix, 0); alpha = color.a; } |