5

enter image description here

Is it possible to turn this generated mapping into an UV Map? If not, would it be possible to access the generated mapping by using bpy?

luk-ry
  • 53
  • 1
  • 3
  • Generated mapping is not using UV map, its using 3D space to map the textures on the mesh. – Denis Jul 17 '15 at 20:47

2 Answers2

4

The problem here is that UV unwrapping simply assigns U (X) and V (Y) coordinates to the mesh, the W (Z) coordinate remains at 0 across the entire mesh. Generated coordinates are based on the 3-dimensional bounding box of the mesh.

However, you can recreate the U and V generated coordinates in a UV map.

Just go into top view (Numpad 7) and hit U > Project From View (Bounds).

enter image description here

This will result in the same U an V coordinates as generated mapping.

For more on texture coordinates see my explanation of texture coordinates here.

PGmath
  • 25,106
  • 17
  • 103
  • 199
  • Generated coordinates are based on the 3-dimensional bounding box of the mesh. -> blender does turn them into UVs for the final OpenGL Eevee render for example. So the code to compute this should be somewhere in blender. And since with cycle with it's "Vector" input allows way more complicated mappings, it would be nice to bake these back to UVs. Is there really no way? – E. K. Mar 29 '20 at 17:36
  • 1
    @E.T. Just an idea: Bake the vectors into a texture. This texture could be read by a script which could try to move the uv-vertices to the according position for a second uv-map... BE AWARE that your UV-map can only work on the vertices provided, so there MAY BE ERRORS. I sadly do not know a inbuilt version of this, nor how one would recognize places where higher resolution would be needed... However, depending on your use case, it might be enough to just create a texture with the vectors and any uv-map and use the texture to drive the uv-coordinates of your actual texture/generator/map/nodes. – Teck-freak Nov 16 '21 at 13:02
0

Following @PGMath advice to Project From View (Bounds), you can project two UVMaps, from top and front, and combine them to produce the same exact result as the generated mapping.

Steps:

  1. Create two UV Maps, name them "Top" and "Front":

    enter image description here

  2. Go to UV Editing Tab, select the "Top" UV Map:

    enter image description here

  3. Go into top view (Numpad 7) and hit U > Project From View (Bounds):

    enter image description here

  4. Go to UV Editing Tab, select the "Front" UV Map:

    enter image description here

  5. Go into front view (Numpad 1) and hit U > Project From View (Bounds):

    enter image description here

  6. Go to the Shader view. On the object's material, create two UV Map nodes, one with Top, the other with Front. Add a Separate XYZ for each one, and combine them with a Combine XYZ. Use the "Top" XY as the XY, and the "Front" Y as the Z.

    enter image description here

The result should be exactly the same as the Generated coordinates:

enter image description here

enter image description here

wxiii
  • 1
  • 1