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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user