<p>The problem was else-where, the same interpolation works for UV coords.</p>

<pre><code>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);
</code></pre>

CC BY-SA 3.0
2017-07-29T17:27:29.600Z
2017-07-29T17:27:29.600Z
scx
<p>Does anyone know who to interpolate UVs in a quad tessellation evaluation shader? I can interpolate the position easily like so :</p>

<pre><code>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);
</code></pre>

<p>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.</p>

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

<p>Thanks</p>

<opengl><texture><glsl><uv-mapping>
How do you interpolate UV mapping coords in a quad tessellation evaluation shader?
scx
# How do you interpolate UV mapping coords in a quad tessellation evaluation shader?

(Asked by: username_0 on 2017-07-29)

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

**Tags:** opengl, texture, glsl, uv-mapping


---

## 1 answers

### Answer by username_0 on 2017-07-29. Score: 1 | Accepted answer

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);

```


---

