I am trying to use a viewport to render a 3x2 cubemap around the Godot cube mesh, but a weird artifact appears on the edge. What do i need to do in order to avoid it?
The viewport (in a 3x2 resolution) has a colorrect with the following code :
// UV range is now u[0:+3],v[0:2]
vec2 r_uv = UV * vec2(3, 2);
// UV now repeat u[0:+1],v[0:+1] in a 3x2 layout
vec2 t_uv = fract(r_uv);
// UV now goes u[-1:+1],v[-1:+1] in a 3x2 layout
vec2 c_uv = (t_uv - .5) * 2f;
COLOR = vec4(c_uv, 0, 1);
This is a simplified code, just splitting the texture in a 3x2 cubemap layout. Then I apply the viewport texture to a cube mesh.
Here are a few screenshot of the seam, in unshaded and wireframe :
As far as I can understand, the vertices on the edge share the same UV coordinates with an edge on another side.
If this is correct, is there a way to prevent it from happening?
Maybe overriding the way vertices read UV? Or is there a way to clamp the coordinates?
Or am i missing something?
(I am using the viewport to procedurally generate a planet map and the cube to render it (thus avoiding the distorsions arond the primitive sphere pole))
I forgot to add a screenshot of the viewport texture :
EDIT2 : changed 'primitive cube' to 'cube mesh' in title and question.