# Perspective correct texture mapping

3d ai algorithm android animation

4 replies to this topic

### #1Ryan Marcus French

New Member

• Members
• 2 posts

Posted 06 January 2012 - 12:11 PM

Can someone give me an overall explanation on what this is?

DevMaster Staff

• Moderators
• 1716 posts

Posted 06 January 2012 - 02:25 PM

http://lmgtfy.com/?q...exture+mapping+
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

### #3Ryan Marcus French

New Member

• Members
• 2 posts

Posted 06 January 2012 - 02:33 PM

You really think that this helps , i need to know what it is now that are alot of sources that are invalid , please dont take the piss.

### #4zbethel

Member

• Members
• 50 posts

Posted 06 January 2012 - 04:24 PM

Chris Hecker has some great articles on this topic: http://www.gamers.or...ker_texmap.html

They're a bit old, but the technique itself hasn't changed at all. In the future, it would be better to ask specific questions about the topic rather than asking people to explain it generically for you. There are better resources immediately available on the web than what we could sum up for you in a few paragraphs. Plus it would be a waste of our time.

Since you asked though, I'll give you a super quick explanation. When you project triangles from the scene onto the screen, you are losing information about depth (i.e. flattening the triangles). If you try and linearly interpolate the pixels in screen space--that is, stepping one pixel at a time, line by line, through the triangle--you don't have the distance information to properly compute what the texture coordinates should be. For instance, moving one pixel to the right on a triangle that is nearly edge-on to the screen (one edge is close to the viewer while the other is far away from the viewer) will need a different result than if the triangle is parallel to the screen. Perspective correct texture mapping fixes this problem by using u/z and v/z instead of just u and v, as well as the interpolated 1/z coordinate for the triangle. The reciprocal is used because it is in fact linear in screen space.

To learn more about it, read Hecker's article or find another article somewhere else that explains in the way that you understand the most.

Cheers,
Zach.

DevMaster Staff

• Moderators
• 1716 posts

Posted 06 January 2012 - 06:09 PM

Ryan Marcus French, on 06 January 2012 - 02:33 PM, said:

You really think that this helps , i need to know what it is now that are alot of sources that are invalid , please dont take the piss.

Actually, it should help. The first link is Wikipedia, which gives you a quick, top-level explanation. The next couple are FlipCode, which is a good site for game code info, and some StackOverflow Q&As which is a great resource to use for any code. There's an MSDN article from Microsoft, the Chris Hecker article zbethel mentions, etc, etc, etc. A basic concept like perspective correct texture mapping is not something that will change over time, so these links have not nor will they somehow become "invalid".

So, yeah, honestly, and with no mean intent, there's a lot more there than you'd get in a forum post.

No taking (or giving?) of piss intended...
Hyperbole is, like, the absolute best, most wonderful thing ever! However, you'd be an idiot to not think dogmatism is always bad.

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users