5
$\begingroup$

well i know about export svg , but i want to know how to use UV as a mesh then use it for shape key ? because vertex ids change after export and import svg , and can't be used for shape key , (For unfolding a mesh ) , is there any addon to do that ?

$\endgroup$
2

5 Answers 5

21
$\begingroup$

(See Update below for Blender 3.0b)


Nowadays, this is quite simple with Geometry Nodes:

enter image description here

To separate any UV islands, duplicating seam vertices, you can split the edges first, and then re-weld them:

enter image description here

For this kind of transition, when you take the modifier's 'Fac' from 0 to 1:

enter image description here

If you would prefer to animate the transition with shape-keys, you could apply the modifiers at the start and end states on copies of your object, without the Weld, to maintain the vertex-count and order.

Then you can 'Join as Shapes' the copies, and edit other in-between keys as you wish. You would have to take care not to separate vertices which are not on seams, but seam verts and non-seam verts could be stashed as vertex groups, to make selection easier.

Update: Blender3.0b

In Geometry Nodes (Fields) the tree can be something more along these lines:

enter image description here

  • Access to the UV Map is now through the modifier's interface
  • Edges can be split inside the node tree
  • .. and in 3.0+, re-welded with Geometry > Merge by Distance

enter image description here

$\endgroup$
10
  • 1
    $\begingroup$ Oooohhh, didn't know this. That's a cool feature. $\endgroup$ Jul 26, 2021 at 10:33
  • 2
    $\begingroup$ This is great, nice answer! Papercraft may take a whole new dimension $\endgroup$ Jul 26, 2021 at 11:45
  • 5
    $\begingroup$ @hamed.design Please be kind to each other. Editing is done to improve the question, e.g. correcting grammar or wording so it's easily understandable. $\endgroup$
    – Robert Gützkow
    Jul 27, 2021 at 16:14
  • 3
    $\begingroup$ @hamed.design Revisions are visible to everyone -> blender.stackexchange.com/posts/231662/revisions This site is a community effort, we suggest edits to questions and answers all day and you can always roll it back... but please take your time when asking a question use proper formatting and grammar so we don't need to do anything (BTW: Robin answered before I edited your question and it became a hot network question because of my suggestions). You are welcome. Read: blender.stackexchange.com/help/how-to-ask $\endgroup$
    – brockmann
    Jul 28, 2021 at 9:26
  • 2
    $\begingroup$ @hamed.design It is absolutely safe to assume, on BSE, that if someone makes an edit to your post, they are trying to be helpful. They are trying to clarify an answer, or make it more likely that your question will attract an answer satisfactory to you. Sometimes they will get that wrong. If that happens to me, I politely decline those parts of the edit I think inappropriate, and briefly explain in the Edit Summary box why I think it doesn't work. Even if the edit is wrong, it can sometimes help me see how my post can be misunderstood by others, and make myself clearer. $\endgroup$
    – Robin Betts
    Jul 28, 2021 at 13:45
6
$\begingroup$

To make a UV map mesh from a mesh's UVs

Nostalgic method, via some scripting

enter image description here Suzanne transforming to her UVs

Using code from Exporting UV Layout with only outlines (similarly to Blender python trying to scale the uv and How to get data and edit it on UV map edges? )

can make a "UV mesh" in the $XY$ plane using the UV coordinates of the active UV map.

import bpy
import numpy as np

ob = bpy.context.object
me = ob.data
uv_layer = me.uv_layers.active
# get uv values
uvs = np.empty((2 * len(me.loops), 1))
uv_layer.data.foreach_get("uv", uvs)
x, y = uvs.reshape((-1, 2)).T

z = np.zeros((len(x)))

uvme = bpy.data.meshes.new("UVMesh")
verts = np.array((x, y, z)).T
#verts -= (0.5, 0.5, 0)
faces = [p.loop_indices for p in me.polygons]

uvme.from_pydata(
        verts,
        [],
        faces
        )

bpy.context.collection.objects.link(bpy.data.objects.new("UVMesh", uvme))

A matching face loop mesh

Equivalent of splitting all edges, to create a mesh from original with no connected faces (to match the UV loops)

import bpy
import numpy as np

ob = bpy.context.object
me = ob.data
coords = np.empty(3 * len(me.vertices))
me.vertices.foreach_get("co", coords)

idxs = np.empty(len(me.loops), dtype=int)
me.loops.foreach_get("vertex_index", idxs)


uvme = bpy.data.meshes.new("UVMesh")
verts = coords.reshape((-1, 3))

faces = [p.loop_indices for p in me.polygons]

uvme.from_pydata(
        verts[idxs],
        [],
        faces
        )

bpy.context.collection.objects.link(bpy.data.objects.new("UVMesh", uvme))

Join as Shapes.

Since the results of running both scripts above will have the same face and vertex counts they can be joined as shapes. To get a similar result shown as obtained by RobinBetts move the origin of UV to (0.5, 0.5, 0) and scale by 2.74 before joining.

$\endgroup$
4
  • 5
    $\begingroup$ "Nostalgic method, via scripting" made my day. $\endgroup$
    – brockmann
    Jul 27, 2021 at 17:01
  • 1
    $\begingroup$ Very nice , this is what i wanted at first , but the Gnodes was awesome , btw this kind of projection will help us to project a geometry pattern on our surface , great for 3d printing , machining manufacturing etc , thanks so much . $\endgroup$ Jul 28, 2021 at 7:23
  • $\begingroup$ Ahh ... those were the days... remember? ... computers had .... 'keyboards'! 8D $\endgroup$
    – Robin Betts
    Jul 28, 2021 at 7:41
  • $\begingroup$ Remember when the G and H keys where in the middle?. Have considered a meta re most annoying shortcut for me is H when I miss G. $\endgroup$
    – batFINGER
    Jul 28, 2021 at 14:52
4
$\begingroup$

Update for Blender 3.2:

Named Attributes are back! It's even easier now:

Mesh to UVs in Blender

You can also use the new Merge By Distance node to join the faces together again.

$\endgroup$
3
$\begingroup$

You can use the Wrap Tools addon by Rich Colburn, video here:

  • Create your object, rip it (V) along the seam you want to create, open the N panel > Extended Tools, click on Create UV Shape, it will create a shape key for this object:

enter image description here

  • Back to Object mode, go into the Shape Key panel, select the second one and put the Value to 1 to "unwrap" the object. If you want to stick an object on the surface, create it, then select it, shift select your first object and press on Bind to Surface then Scene Update:

enter image description here

To bring back the object to its original shape, bring back the shape key Value to 0, the other object will follow:

enter image description here

$\endgroup$
2
  • $\begingroup$ Seems very useful! $\endgroup$
    – mugnozzo
    Nov 12, 2021 at 10:30
  • $\begingroup$ Yes it can be, either to get a mesh kind of unwrap, or to stick an object on it (like for example pattern on an object, collar on a necks, etc) $\endgroup$
    – moonboots
    Nov 12, 2021 at 10:31
1
$\begingroup$

Geometry Nodes for this are great, but they don't allow you to work on the mesh, because Geo Nodes are seen as a modifier.

If you want to be able to work on the unwrapped mesh, use TexTools:

https://github.com/SavMartin/TexTools-Blender/releases/tag/v1.5

In the UV editor, there's a Mesh UV Tools section and a button for Create UV Mesh. This will create a new mesh that has a shape key already in it. Set the shape key to 0 and you get your original mesh. Set it to 1 and you get the UV.

$\endgroup$
1
  • 1
    $\begingroup$ Or just apply the geonodes modifier. :) $\endgroup$ Oct 3 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.