OpenGL software texture mapping

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

Recommended Posts

Hi, I got a tri and it's U and V coordiantes, plus I also have the world-space intersection point and what I think is barycentric coordiantes of the of the intersection point. now I'd like to get the U and V for the intersection point. One idea I have is: a triangle ABC, hitpoint H. Construct a line that lies on A and H and calculate it's intersection D with the opposite edge BC. Now I interpolate BC to get U and V for D, then interpolate A and D to get U and V for H Seems to be quite an intuitive solution, but I guess there must be something faster (considering how many times this will be done). I've googled for some solutions, but most sutff points to texturing and rasterizing in D3D or OpenGl. I know a regular engine would interpolate along the edges and then along the scanlines, but I'm writing a raytracer (seems everybody is writing a raytracer lately ;)) and don't think calculating the edge U and V for the scanline I'm doing is a good method since it lacks in flexibility.

Share on other sites
Check here:
http://www.flipcode.com/articles/article_raytrace07.shtml

Explains a bit about barycentric coordinates, and how to get u/v. Source code included.

Share on other sites
Hi,
thanks for pointing that out, I missed it somehow in the article.

I was just not very clever. I didn't realise I can use the baricentric coordinates I already have and instead of X and Y just plug in the U and V. I was thinking long about finding the U and V axes from the three U and V pairs. Then I realised I might do it the way I described in my initial post. And now I see I had the solution right before me all the time.

1. 1
Rutin
47
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632994
• Total Posts
3009769
• Who's Online (See full list)

There are no registered users currently online

×