How to find UV coordinates

Started by
6 comments, last by mathers3000 15 years, 2 months ago
I'm trying to figure out a way to find the actual "vertex location" from a .uvw file. ie: vertex1 is located at (x7,y2) on the bitmap, and so on... Does anyone know how you might find these coordinate numbers? Also how might you find the edges and polygons too? Any help would be appreciated :D
Advertisement
I don't know exactly what a *.uvw file contains (never heard of it as a standard file format), but let me see if I understand you correctly. You know how to read the texture coordinates and you want to find, basically, the pixel on the bitmap. If that is correct, then:

The texture coordinates will normally be specified as values between 0 and 1. These correspond to the range of pixel values on the image. So, if you have a 256 pixel wide image, then u = 0 is the left-most pixel, e.g., pixel column 0, nad u = 1.0 corresponds to the right-most pixel, e.g., pixel column 255. Similarly, if you have a 1024 pixel wide image, then u = 0 corresponds to pixel column 0 and u = 1.0 corresponds to pixel column 1023. The v coordinates map in a similar way to image pixel rows, and depending on which graphics API you are using the 0 row may be at the top or bottom of the image.

There are a couple of things to be aware of...

Sometimes, there will be a texture transform applied to the texture coordinates, e.g., the coordinates can be stretched or rotated or projected to achieve different effects (such as a projected texture, or to animate the texture on the surface). The transform would be applied before mapping to the image pixel. So, tex coord (0.25, 0.75) could map to, say, (1.5, -7.3) or whatever.

Secondly, if the final texture coordinate is outside the range 0 to 1, then different rules can be applied to bring the texture coordinate back into 0 to 1 to map to the image. For example, the "clamping" rule would just say if u < 0, then let u = 0, or if u > 1, let u = 1. And the tiling rule would look take the remainder of fmod(u, 1.0) and use the remainder as the final u to map to the image. In this way, you can have a texture that has one high resolution brick, then stretch the texture coordinates to make an array of high resolution bricks on the surface without having to have a super high resolution texture that has itself many repeated bricks.

Does that help?
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
No, sorry, let me be a little clearer. I am using 3ds max. After completing the model, i apply a UVW Map modifier, and then a UVW unwrap modifier. I can then choose to save a flat 2D image as a .uvw file. This file might only be readable through max. However, I can also export a .obj file with its UV coordinates attached.

So basically i'm trying to read these files, so I can calculate all the triangles (polygons) myself. I just need to find someway either through maxscript, or other means where I can see the pixel number and xy, or uv locations on the 2d map.

Thank you
Quote:Original post by mathers3000
I'm trying to figure out a way to find the actual "vertex location" from a .uvw file.
ie: vertex1 is located at (x7,y2) on the bitmap, and so on...

Does anyone know how you might find these coordinate numbers? Also how might you find the edges and polygons too?

Any help would be appreciated :D


The name .uvw implies it contains UVW coordinates, not vertices. It's doesn't describe your model completely, so I don't see how this is possible.

I think I found the functions for maxscript I was looking for.

<void>setUVSpace <integer>UVSpace
//Sets the UV Space fly out in the edit floater, where UVSpace defines the space that you want to view the texture vertices in:

1 - UV
2 - VW
3 - UW

This looks like a great site, all the information you need about UVW functions built into max and how to call them. http://www.kxcad.net/autodesk/Autodesk_MAXScript_Reference_9/Unwrap_UVW_Modifier.htm

I don't know if this helps, but I use a great little program called lithunwrap which has a nice simple UV coordinate editor in there (it also has a pile of other features which you may find useful).
There was a saying we had in college: Those who walk into the engineering building are never quite the same when they walk out.
mathers*,

Did the site you found help you find an answer to your question?
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Yes it did! In fact, it had a lot more useful information about UVs than I thought was possible. I'm now learing maxscript.

This topic is closed to new replies.

Advertisement