Skip to main content
edited body
Source Link
scx
  • 169
  • 7

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(p1p2, p2p1, 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

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(p1, p2, 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

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

Source Link
scx
  • 169
  • 7

How do you interpolate UV mapping coords in a quad tessellation evaluation shader?

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(p1, p2, 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