Archived

This topic is now archived and is closed to further replies.

Perspective Texture Mapping

This topic is 5507 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

Am tryin to do perpective texture mapping by interpolating my UV values and then dividing them by 1/1/z(think thats rite not too sure tho). Anyway after the division i then multiply the result by the resolution of image in the relavant direction. Watever calculations i try the result always ends up being to big. My z values range from -1000 to about 200 or between -2.7 and 2 depending on which coordinate space i use. I dont no if this has any effect on the result? Can anyway shed any light on the situation?? Thanks

Share this post


Link to post
Share on other sites
You should be interpolating us = (u / w), vs = (v / w) and (1 / w) in screen space, then divide us and vs by the (1 / w) value at each pixel to get back to the view space u,v coordinates. w is your post-perspective-transform w (which is just z scaled and translated, so you might be able to fake it by just using z).

Now all of the above will simply give you view-space linear texture coordinates. The actual size of the texture on screen will depend on the exact u,v and any scaling you apply after the above process. (ie just tweak your coordinates and scaling until it looks right, if it''s too big, just scale it less)

Share this post


Link to post
Share on other sites