Sign in to follow this  
mathers3000

How to find UV coordinates

Recommended Posts

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

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