FBX - UV usable range?

Started by
9 comments, last by L. Spiro 9 years, 6 months ago

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

Advertisement

(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).

(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 ;-)

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

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid


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
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...

It's easy to check in practice. For example for the attached texture the U range is [-3.61...4.82]. But obviously it can't be tiled rationally with assumption the range is [0..1]

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?

current project: Roa


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.
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.

This topic is closed to new replies.

Advertisement