Alright, I have a huge issue with my tessellation and i need help understanding the problem.
I m generating 4 Quads which i do manual Mapping on them for now, The mapping is done like that
Quad box;
box = new Quad(10 * (xEnd - xStart), 20 * (yEnd - yStart));
box.clearBuffer(VertexBuffer.Type.Index);
box.setBuffer(VertexBuffer.Type.Index, 4, BufferUtils.createIntBuffer(0, 1, 2, 3));
box.setMode(Mesh.Mode.Patch);
box.setPatchVertexCount(4);
Vector2f[] texCoord0 = new Vector2f[4];
texCoord0[0] = new Vector2f(0.0f, 0);
texCoord0[1] = new Vector2f(0.2f, 0f);
texCoord0[2] = new Vector2f(0.2f, 1f);
texCoord0[3] = new Vector2f(0.0f, 1f);
Vector2f[] texCoord1 = new Vector2f[4];
texCoord1[0] = new Vector2f(0.20f, 0f);
texCoord1[1] = new Vector2f(0.40f, 0f);
texCoord1[2] = new Vector2f(0.40f, 1f);
texCoord1[3] = new Vector2f(0.20f, 1f);
Vector2f[] texCoord2 = new Vector2f[4];
texCoord2[0] = new Vector2f(0.40f, 0f);
texCoord2[1] = new Vector2f(0.60f, 0f);
texCoord2[2] = new Vector2f(0.60f, 1f);
texCoord2[3] = new Vector2f(0.4f, 1f);
Vector2f[] texCoord3 = new Vector2f[4];
texCoord3[0] = new Vector2f(0.60f, 0f);
texCoord3[1] = new Vector2f(0.80f, 0f);
texCoord3[2] = new Vector2f(0.80f, 1f);
texCoord3[3] = new Vector2f(0.60f, 1f);
//Later Clone and Map are set For Each Of Them
box.setBuffer(Type.TexCoord, 2, BufferUtils.createFloatBuffer(texCoord0));
From there i did test with a Unshaded Material and the Visual was perfectly fine(Btw i didn’t do the remapping of VerticeBuffer only the texture UV position), But once i use this on My own MatDefinition for Tessellation, The mapping get all messed up. There seem to be a side Pulling toward a specific Direction.
I know it won’t be easy to trouble shoot the problem but there is 2 place it goes wrong, The first is the code up there, the second is Tessellation Evaluation Shader which doesn’t have the write formula for UV mapping.
vec2 interpolate2D(vec2 v0, vec2 v1, vec2 v2, vec2 v3)
{
return v0 + vec2(gl_TessCoord.x) * v1 + vec2(gl_TessCoord.xy) * v2 + vec2(gl_TessCoord.y) *v3;
}
void main(){
return v0 + vec2(gl_TessCoord.y) * v1.y + vec2(gl_TessCoord.yx) * v2 + vec2(gl_TessCoord.x) *v3.x;
}
Does anyone know how i could fix this issue
picture for visual people