1
$\begingroup$

Does anyone know who to interpolate UVs in a quad tessellation evaluation shader? I can interpolate the position easily like so :

vec4 p1 = mix(gl_in[0].gl_Position,
        gl_in[1].gl_Position,
        gl_TessCoord.x);
vec4 p2 = mix(gl_in[2].gl_Position,
        gl_in[3].gl_Position,
        gl_TessCoord.x);
gl_Position = mix(p2, p1, gl_TessCoord.y);

But I can't figure out how to interpolate the incoming UV coordinates. I need to do so to pass them on to the fragment shader.

With perfect quad UVs from 0 to 1, I can use gl_TessCoord.xy. Unfortunately that doesn't work when the UVs aren't mapped 1:1 to a texture.

Thanks

$\endgroup$
1
$\begingroup$

The problem was else-where, the same interpolation works for UV coords.

vec2 uv1 = mix(teUv[0], teUv[1], gl_TessCoord.x);
vec2 uv2 = mix(teUv[2], teUv[3], gl_TessCoord.x);
fUv = mix(uv2, uv1, gl_TessCoord.y);
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.