I have created a tessellated plane through triangle tessellation. I would like to make each internal new triangle move up and down on the y axis, independently from the others. I would like to modify their gl_Position to do so, in either TES or TCS, but all I obtained till now is to make all the primitives to move simultaneously. How can I achieve my goal?
Here is the tessellated plane [plane]: https://ibb.co/jWRjvH ""
Here is my TCS
#version 450 core
layout (vertices = 3) out;
// Input Block
in VS_OUT{
vec2 UV;
} tcs_in[];
// Output Block
out TCS_OUT{
vec2 UV;
} tcs_out[];
void main()
{
if(gl_InvocationID == 0)
{
gl_TessLevelInner[0] = 10.0;
gl_TessLevelOuter[0] = 10.0;
gl_TessLevelOuter[1] = 10.0;
gl_TessLevelOuter[2] = 10.0;
}
gl_out[gl_InvocationID].gl_Position=gl_in[gl_InvocationID].gl_Position;
tcs_out[gl_InvocationID].UV = tcs_in[gl_InvocationID].UV;
}
Here is my TES
#version 450 core
layout (triangles, equal_spacing, cw) in;
// Input Block
in TCS_OUT{
vec2 UV;
} tes_in[];
// Output Block
out TES_OUT{
vec2 UV;
} tes_out;
void main()
{
gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
gl_TessCoord.y * gl_in[1].gl_Position +
gl_TessCoord.z * gl_in[2].gl_Position);
tes_out.UV = gl_TessCoord.x * tes_in[0].UV +
gl_TessCoord.y * tes_in[1].UV +
gl_TessCoord.z * tes_in[2].UV;
}
}