Jump to content
  • Advertisement
Sign in to follow this  
Riviera Kid

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Guest Anonymous Poster
The example of your 1/z interpolation isn't linear.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!