Jump to content
  • Advertisement

Archived

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

orenk2k

unreal models texture format??

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

Hello. i''m working on unreal tournament model viewer and i have a little problem, i read all the info form the model files, and draw it on screen but from some resone i didn''t understand the idea of storing the UV texture coords in a ''char'' variable. i get some values of U = 178 , V = 56 and so on, my question is: HOW DO I CONVERT THOSE VALUES TO BE USED IN MY glTexCoord function? (float vars!) --> Thanks alot <--

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
A char takes a fourth of the place of a float, that''s why people store texcoords in chars. Conversion is easy, divide by 256.0, that''s it.

U_float = (float)U_char/256.0;
V_float = (float)V_char/256.0;

- JL

Share this post


Link to post
Share on other sites
well, i tried this ofcourse!, but my texture image size isn''t 256 x 256 it''s
252 x 195. and it''s not looking good at all, any ideas??

--> thanks <--

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Texture coordinates in a 3d file (unreal''s, quakes, whatever) are independent of texture resolution. They just tell you how the mapping plane is applied to the polygons. The 255 in a u/v char doesn''t mean you have to use 256*256 textures, it''s just the maximal range of a char and corresponds to 0.9999... float.
If your texture isn''t square and has a weird aspect ratio, then it''s upon you to adjust texture coordinates to prevent bad distortions.

-JL

Share this post


Link to post
Share on other sites
this is my code:

A = (frame * header.numofVertices) + triangles.iVertex[0];
B = (frame * header.numofVertices) + triangles[i].iVertex[1];
C = (frame * header.numofVertices) + triangles[i].iVertex[2];

TexCoord[0][0] = (float)(triangles[i].mTex[0][0])/255;
TexCoord[0][1] = (float)(triangles[i].mTex[0][1])/255;

TexCoord[1][0] = (float)(triangles[i].mTex[1][0])/255;
TexCoord[1][1] = (float)(triangles[i].mTex[1][1])/255;

TexCoord[2][0] = (float)(triangles[i].mTex[2][0])/255;
TexCoord[2][1] = (float)(triangles[i].mTex[2][1])/255;

glTexCoord2d(TexCoord[0][0] , TexCoord[0][1]);
glVertex3f(x+(points
--> THANKS ALOT <--
' Target=_Blank>Link

Share this post


Link to post
Share on other sites
(hey why the code cut away??!) well this is the rest of the code:

glTexCoord2d(TexCoord[0][0] , TexCoord[0][1]);
glVertex3f(x+(pointsLink

Share this post


Link to post
Share on other sites
orenk2k : Could you send me some specifications(structure/file reading code/your code?/links..anything would be useful) of UT models.. can your program also open levels? ... could you post some images...
TNX
email : mirko.teran@guest.arnes.si

There are more worlds than the one that you hold in your hand...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!