PDA

View Full Version : importing uv mapped model



Penance
05-18-2002, 12:02 PM
I looked at the ASE file that MAX spit out and it doesn't look too bad. I mean, it gives me all by vertices and their coordinates, so I can build my model easily!

What I'm curious about is how to take the texture map data and use it to get my texture on my model correctly using openGL.

For instance, I've UV mapped my model in MAX, exported it as an image file using texporter and drawn the texture for my model so it looks perfect (I can just slap it on my model in max and it looks like it should)

Now, how do I take that texture and get it mapped onto my model correctly in GL? glTexCoord2f() takes only 2 parameters, while MAX gives me texture_vertices with x,y,z coordinates.
Am I supposed to somehow translate those into the proper [0,1] range for the glTexCoord2f() params, for each vertex? If so, how?

V-man
05-18-2002, 09:20 PM
I dont know what the third component is suppose to represent in those file formats, but in opengl the third (r) is for 3D textures and is not used for 2D textures or 1D textures. The fourth (q) can be used for proper mapping of a texture onto a triangle. It is similar to the w for vertices. A kind of perspective transform factor.
Also, it can be used for 4 dimensional textures. The same can be said for vertices. So all this time, we have been lead to beleive that opengl is for doing 3D graphics, but in fact, it is for doing 4D graphics. http://www.opengl.org/discussion_boards/ubb/smile.gif

Plug them into glTexCoord3f or glTexCoord4f and see what happens.

V-man

AdrianD
05-22-2002, 04:00 AM
Unless you are using 3D textures (bitmap OR procedural) in your model, you can just ignore the 3rd mapping component.

Devulon
05-23-2002, 02:13 AM
Exactly. Just ignore the 3rd coord. The three coordinates correspond to the uvw coords in max. The third coord is only used if you set your coord generating (in UVWMap) to be something that involves a W coord. Changin this in the material doesn't really matter unless you change the mapping for the objects. Basically this is all max stuff and pertains to doing cube mapping and other things in max.

As far as you are concerned, if you are manually mapping stuff and even if you are using UVWMap as is chances are that you will never need the 3 coord. I never have. If you read through the max Docs for like 2 months you might start to understand why its there. But trust me it isnt' worth it.

Devulon