0
\$\begingroup\$

I've received a few instructions on what kind of usage UV maps allows, and currently try to understand how it works. However, I can't figure out what kind of data there is inside a UV map.

Googling around, I found... almost nothing. Maybe this simple example. That was totally unexpected. Is it non standard, with as many possibilities as software vendors ?

Anyway, if that is the case, I'm nonetheless interesting in understanding what kind of data can be found inside an UV map save file, in order to properly complement my understanding of the process, and try to figure out what kind of post-processing would be possible.

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Unsure what exactly you are asking for. UV Coordinates are usually stored within your 3D Model, which are the Coordinates for the Texture files which are applied to it. You need UVs in order to know which "part" of a texture (or normal map or displacement map or ...) corresponds to which part of your 3D model. \$\endgroup\$ Commented Oct 7, 2014 at 12:39
  • \$\begingroup\$ Yep, exactly. Thanks for making that clearer. Is there a "standard format" for such a file, or at list some "best practice" on what such a file is supposed to contain ? (specifically regarding UV map) \$\endgroup\$
    – Cyan
    Commented Oct 7, 2014 at 12:43
  • 1
    \$\begingroup\$ Do you mean standard format for 3D models or for texture files? In both cases the answer is no, but there are some popular formats used for both(for 3D models OBJ and FBX are pretty popular, for Textures you could use nearly anything, but DDS is often recommended) (though in commercial Game Engines these only matter for initial importing as they are later on converted to custom binary formats for faster loading) \$\endgroup\$ Commented Oct 7, 2014 at 12:47
  • \$\begingroup\$ For the "UV map" part of 3D model only. Finding information on this for popular format is good enough at this stage. \$\endgroup\$
    – Cyan
    Commented Oct 7, 2014 at 12:50
  • 1
    \$\begingroup\$ As I mentioned, every format stores it slightly differently. The two most common ones are OBJ (which you can open in a text editor to read the values) and FBX (commercial by Autodesk, binary format). However each 3D Modelling Tool has its own format as well, some of which can be opened in Text Editors (such as Maya ASCII). \$\endgroup\$ Commented Oct 7, 2014 at 12:56

1 Answer 1

3
\$\begingroup\$

An UV map is usually literally 2 extra floats per vertex, one for the U, and one for the V, how they are stored is dependent on the model format used and not really relevant to how you use them.

How they are used in modern applications is typically completely defined in the fragment shader, a common use is to take the UV values and use them as the coordinates from which you sample an image and use that as the base color for the model at that point on the triangle.

What you can do with them is practically unlimited, it's just 2 extra floats and you can interpret them any way you like in a fragment shader.

As UnholySheep pointed out, it is also possible to change, or even create them in different shaders, for example a geometry shader for particles could emit a quad with appropriately offset UV values from a particle atlas, meaning you'd only need to upload 1 set of XYZ/UV values per particle you want rendered.

\$\endgroup\$
4
  • \$\begingroup\$ Their usage is not completely defined in the fragment shader, you can also modify/use them in the vertex and geometry shader (whether you really should do that is a different topic) \$\endgroup\$ Commented Oct 7, 2014 at 13:02
  • \$\begingroup\$ Good point, I'll add that in. \$\endgroup\$
    – Elva
    Commented Oct 7, 2014 at 13:02
  • \$\begingroup\$ Thanks. So I guess it means : UV map typically doesn't exist as such, they are more likely an entangled part of the 3D model. \$\endgroup\$
    – Cyan
    Commented Oct 7, 2014 at 13:18
  • \$\begingroup\$ Yeah, UV mapping is basically the mapping between vertices and a position on a texture, to get a model looking all pretty :) \$\endgroup\$
    – Elva
    Commented Oct 7, 2014 at 14:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .