Shader Transition effects in UV

  1. Consider not naming variables in GLSL vec3 rgb, since .rgb is an alternative to .xyz when reading vector components (ie. you can now do rgb.rgb which will quickly lead to endless amounts of confusion, and GLSL is confusing enough without that :smiling_face_with_tear:)

  2. The issue is caused by the fact that you’re trying to pick a sample outside of the texture (and, by default, three will just clamp the sample to the edge color - docs.) You can check if the sample coordinates are within 0.0 - 1.0 range and just don’t do the mixing in case they aren’t, for example:

if (slideCoord.x < 0.0 || slideCoord.x > 1.0 || slideCoord.y < 0.0 || slideCoord.y > 1.0) {
  gl_FragColor = gray;
} else {
  gl_FragColor = texture2D(u_texture, slideCoord) * vec4(slideColor, 1.0);
}