# Perspective texture mapping question.

This topic is 5463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi. I am about to implement perspective texture mapping and i was wondering about the theory. As far as i am aware you interpolate 1/z, u/z, v/z and u = (u/z)/(1/z) v = (v/z)/(1/z) okay. but i dont get why you have to interpolate 1/z. Why not z then multiply by z instead of divide by 1/z. lets say you have a point A where z =1 and a point B where z = 10. interpolate from 1/1 to 1/10 so you have 1/1, 1/2, 1/3, 1/4, 1/5, 1/6, 1/7 etc or if you just interpolate z you get 1,2,3,4,5,6,7 etc so you might have u = (u/z) / (1/5) so why not just have u = (u/z) * 5 so my point is why cant you just interpolate u/z, v/z, z and u = (u/z) * z v = (v/z) * z it seams just as reasonable to me and faster.

##### Share on other sites
It's because x'/z'=x/z which solved for x' is (x*z')/z. Perspective projection is just using similar triangles to find the intersect of a ray and a plane.

##### Share on other sites
The example of your 1/z interpolation isn't linear.

##### Share on other sites
To give an example, try interpolating z=1 to 4, getting

z=1,2,3,4

Now try interpolating 1/z:

1/z=1, 3/4, 2/4, 1/4 => z=1, 4/3, 2, 4

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 15
• 22
• 13
• 14
• 45