Sign in to follow this  

FBX - UV usable range?

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

Hi All

 

I've a problem with FBX textures import. For example a minimun U(V) coordinate is  -0.04 and a maximim one is 0.96.  But what U(V) range is really used for mapping? Variants

 

[0..1] (most probably)

[-1..1]

[-0.04..0.96] (it's unlikely)

 

Same question can be re-formulated as: what position in UV space does correspond to image center? (0.5, 0.5) or (0, 0) or (0.48, 0.48)? The texture translation is (0, 0), can't help

 

Thanks

 

Tommato

Share this post


Link to post
Share on other sites

(0.5, 0.5) maps to the image center. The UV range is [0..1] when the actual texture lookup happens, but your UVs don't have to be confined to that range. The result of a UV that is outside the [0..1] range depends on your texture addressing mode. If the mode is CLAMP, then UVs less than 0 will clamp to 0, and UVs greater than 1 will clamp to 1. If the mode is WRAP, then the fractional part of the UV is used (and if that's less than 0, 1 must be added. ie -0.04 becomes 0.96, -0.75 becomes 0.25, etc).

Share this post


Link to post
Share on other sites

(0.5, 0.5) maps to the image center. The UV range is [0..1]

So it's hard-coded/predefined? But what to do with large UV ranges like [-100..+100]? I'm confused because AFAIK UV are created in modeler and can be any. Does FBX guarantee the UV mapping is always "normalized" in range [0..1]? If so where it's written in doc?

 

Thanks and sorry for a lot of questions  ;-)

Share this post


Link to post
Share on other sites

So it's hard-coded/predefined?

No. [0,0] is the upper-left corner of the image and [1,1] is the lower-right. [0.5,0.5] is the center. It is not “predefined”, it is the result of the convention.

But what to do with large UV ranges like [-100..+100]?

This question doesn’t make sense. It implies there is something you have to do, and there isn’t. What should I do if my hair is blonde?
If the UV’s go from -100 to 0, then the image repeats 100 times. If they go from 0 to 100, it repeats 100 more times. -100 to 100? 200 repeats. Asking “what to do” about it doesn’t make sense. What should you do if the vertex color is purple?

Does FBX guarantee the UV mapping is always "normalized" in range [0..1]?

Of course not. How could you repeat textures (except by doubling the geometry at every interval, which doesn’t make sense when all you would otherwise have to do to get 2 repeats of a texture is use coordinates from 0 to 2)?

For example a minimun U(V) coordinate is  -0.04 and a maximim one is 0.96.  But what U(V) range is really used for mapping?

-0.04 to 0.96. The texture is slightly shifted. So what’s the problem? Why would you use any numbers other than what is in the file?


L. Spiro

Share this post


Link to post
Share on other sites


No. [0,0] is the upper-left corner of the image and [1,1] is the lower-right. [0.5,0.5] is the center. It is not “predefined”, it is the result of the convention.
I see no any difference, anyway constant values are used

 


If the UV’s go from -100 to 0, then the image repeats 100 times. If they go from 0 to 100, it repeats 100 more times. -100 to 100? 200 repeats.
It's only in OpenGL (black sheep in 3D family). Generally 3d apps can write any UV values

Share this post


Link to post
Share on other sites
OpenGL works the same as every other graphics API, except that is uses an upside down convention where (0,0) is the bottom-left corner and (1,1) is the top right.
Where are you getting this magic 0.04 value from? It's unrelated to GL.
If your texture is 25 pixels wide, then the width of one texel is 0.04 UV units...

Share this post


Link to post
Share on other sites

For example for the attached texture the U range is [-3.61...4.82].

 

 

What do you mean? Textures don't have UV values. There's no point in assigning texture coordinates to a texture. Where do you get these numbers from?

Share this post


Link to post
Share on other sites


There's no point in assigning texture coordinates to a texture
Please look at image above. From FBX I've read the texture map that has this image and uses UVs, I know their ranges. FBX texture scales are 1.0 and translation is 0.0. Please tell me how the texture should be mapped? Or, in other words, how to calc what pixel corresponds to a vertex? IMO there are not enough data, that's what I'm looking for.

Share this post


Link to post
Share on other sites
Didn't Samith already answer that way back #2? The only question is which wrap mode is used (the modeling program would have to specify that), but it's most likely either GL_REPEAT or GL_MIRRORED_REPEAT. Edited by BitMaster

Share this post


Link to post
Share on other sites
FBX doesn’t specify wrap modes. It should always be repeat implicitly. I am waiting for Autodesk to confirm this.

Or, in other words, how to calc what pixel corresponds to a vertex? IMO there are not enough data, that's what I'm looking for.

You already had that data in your very first post where you gave the example of [-0.04,0.96].

Why don’t you run the Autodesk sample “Autodesk\FBX\FBX SDK\2015.1\samples\ImportScene\” and look at all the data yourself?
Or view the FBX file in real-time via “Autodesk\FBX\FBX SDK\2015.1\samples\ViewScene\”?

Everything you’ve been asking is answered right there.


L. Spiro

Share this post


Link to post
Share on other sites

This topic is 1180 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.

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