PDA

View Full Version : Texture Coordinates



Omega
May 11th, 2009, 08:50 PM
When exporting a model with HMTv3.5 you get a .obj file. I tried loading this file in my own little OpenGL program. I can draw a wireframe of the object. But textures aren't working properly. The texture coordinates seem to be wrong.

OpenGL expects them to be between 0 and 1, but in the obj file created by HMT they are not within this range (some are negative).

So what do the texture coordinates in these .obj files actually represent? How do they map to your actuall texture?

Skarma
May 11th, 2009, 09:47 PM
I spoke with you earlier on xfire, so I'm not sure if you posted this before or after that since we didn't get anything completely solved.

I just went into Guerilla and checked out a few GBXModels and none of them have negative texture coordinates, so it's possible that you have the wrong vars. I don't think PC maps have compressed coordinates, but if they do, they are 16-bit vars, otherwise they are uncompressed floats. So, my conclusion is you have the wrong vars, because texture coordinates only have negative values if there is a mirroring effect. Since the range conversion I gave you didn't work, which it should have, I'm positive. Unit vectors can be tricky! :raise:

Lightning
May 11th, 2009, 10:26 PM
I thought HMT did not export UVW's properly?

p0lar_bear
May 12th, 2009, 12:52 AM
I thought HMT did not export UVW's properly?

This is correct.

Omega
May 12th, 2009, 07:49 AM
I thought HMT did not export UVW's properly?

Ah ok.

Is there any program that will export them correctly?
And possibly something to convert them to an .obj file?

Thanks for the info.

Advancebo
May 12th, 2009, 08:27 AM
Get someone to send you an obj file of the model from CE?

Limited
May 12th, 2009, 01:38 PM
Ah ok.

Is there any program that will export them correctly?
And possibly something to convert them to an .obj file?

Thanks for the info.
I'm thinking one of Jahrain or Firesythes apps must do it, only guessing but they did alot of texture/mesh stuff.

Omega
May 12th, 2009, 02:12 PM
I downloaded the HEK and used GbxModelConverter to convert the GBXModel to an .obj model. Now it works perfectly :)

Limited
May 12th, 2009, 02:16 PM
C# or C++, OpenGL?

bobbysoon
May 12th, 2009, 02:46 PM
aww, i was gonna dig up and flaunt a script i put together to transform texture coordinates. At least I don't gotta make it user friendly now

Skarma
May 12th, 2009, 11:31 PM
From what I know, he's doing it OpenGL for a school project and we can only hope it is in C++!