# Silly question about perspective correct texture mapping

OK, I'll admit, the math on a perspective projection matrix is quite hairy for me, but I get the general gist of it: morph the object so that it looks... perspective-ish.

But there is one thing which I really don't get it: if I send the textcoord for a vertex to a "smooth out fTexCoord" varying variable, how is that interpolation affected by either the clip space coordinates (x,y,z,w), where w actually has a value !=1 or a naive implementation without the w component? Is the interpolation happening in clip space?

I mean, I understand WHY half a quad texture looks squished at the diagonal if looked from a perspective type of camera, because one triangle is morphed and it's texture coordinates just fill a smaller area than the triangle which is closer to the camera.

What I don't understand is how clip space avoids thats. I mean, isn't the fTexCoord just interpolated based on the distance against the tree verts? And if I can give naive gl_Position values, and OK clip space gl_Position values, and they occupy the same space in... space, how can the perspective correct texture mapping help that?

• the update u = (u/w)/(1/w) doesn't do anything. If you simplify the right side, you just get the left side. Same for v. – Arne Oct 22 '15 at 9:59
• @Arne The point is that you interpolate u/w and 1/w linearly in screen space, then use them to calculate u per pixel. That's how you get u to be interpolated with perspective correction. – Nathan Reed Oct 22 '15 at 17:16
• ok I found some resources on the internet, and understood this part. It's not that easy to understand and even other sources use the same notation. Still I think you should really concider weather u = (u/w) / (1/w) is what you want to keep in this document. Maybe you want to indicate, that you mean two different u and two different w. – Arne Oct 22 '15 at 21:36