Sign in to follow this  
enigmagame

Map texture triangle to a right triangle

Recommended Posts

Hi! In a my precedent post, I've implemented this method: I've a model with texture, I read the frame buffer and I store the data on a image. Now I take the same model, but without the original texture, and I want to texture this model with the precedent image. It runs correctly. Now I want to create a compact texture map from this image, so map each triangle of the texture to a right angle triangle, and these are packed together. The problem is choose a correct size of this right triangle (that must be a multiple of 2^n). Trying a "random" number, the method runs correctly but the result is, obviously, ugly. It appears blurred. With my teacher I've found a method to determinate a correct right triangle size. Must be find the projected area of the triangle (in pixel), and must select the right triangle, of dimension 2^n, that approximates the original area. For example, if a triangle have a projected area of 37890 pixel, the n value is: log2(37890)=15.2 I can choose 15 or 16. A right triangle of 2^16 pixel is 65536. Now we must found the width and the length of this triangle with (width=length). So l=sqrt(65536*2)=362, this value is expressed in pixel. This is my problem: with this l value, how can I return to the value in world space coordinate? If I find this value, I can construct the righ triangle and map the texture. I hope that this post is not confused! Thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this