3
$\begingroup$

I'm looking for a way to generate a 3D jigsaw puzzle with random pieces using only nodes. It should be scalable and accept various mesh as input: Grid, plane, cube, spheres, cones, custom mesh. Pieces should be able to be created for quads, triangles, or ngons.

The workflow would be as follows:

  1. Instance mesh
  2. Convert faces to curves
  3. Subdivide curves (to 2 control points with handles)
  4. Move/Adjust only the non corner curve points /handles towards face center.
  5. Rotate individual curve handles to randomly create a unique piece shape on each face.

I have started putting together a node tree for this task, but so far I haven't been able to figure out to move individual control points and rotate handle on the face geometry (polygon) underneath.

See images for details.

starting cube

curves (with double edges)

Puzzle piece

nodes attempt

Full nodes.

Here the blender file for those who are wondering what I have done so far. Slide the scale on the curve handle values. I wanted to have the scale change the handles following the face normals or lines.

the lines help randomize the puzzle pieces since it uses a nearest node and the algorithm has to decide randomly which face is the nearest.

The results should look like the following:

Scalable and flexible.

Desired 1x1x1 cube puzzle

Desired cuboid puzzle 3x3x3

$\endgroup$
7
  • $\begingroup$ Please be so kind and show us a screenshot of the whole node tree, or share your blend file: blend-exchange.com Thank you! $\endgroup$
    – quellenform
    Commented Oct 27, 2022 at 1:07
  • $\begingroup$ After some thought, I'm afraid I have to say: it's not clear to me, based on the questions you've asked, exactly what your goal is. If you convert faces to curves, you would have to split them off first. And if you have two subdivision levels, you create three more points per edge. This does not correspond to your sketch. What exactly do you mean by "unique piece shape on each face"? You have a curve here. Please be so kind and edit the question again and try to better sketch the desired result. Thank you! $\endgroup$
    – quellenform
    Commented Oct 27, 2022 at 10:48
  • 1
    $\begingroup$ for me it looks like he wants to make a 3d puzzle... ;) $\endgroup$
    – Chris
    Commented Oct 27, 2022 at 10:53
  • $\begingroup$ just curious: Are the curves created with a Mesh To Curve node? If yes, how can you see the curve handles? $\endgroup$
    – Blunder
    Commented Oct 27, 2022 at 10:56
  • $\begingroup$ Check my blender file @Blunder it contains a node that shows curve handles. $\endgroup$
    – geomatico
    Commented Oct 27, 2022 at 16:10

1 Answer 1

3
$\begingroup$

To be honest, the task is not quite trivial to solve and requires a relatively high number of nodes.

However, the result is quite respectable:

enter image description here

Here I use the following node tree:

enter image description here

The difficulty here lies in the selection of the right points, and in the topology of the mesh.

Briefly explained I do the following:

  1. First I subdivide the cube with Subdivide Mesh into the desired number of subdivisions and capture with Capture Attribute the position and index of the resulting edges. These values will be needed later.

  2. Then I instantiate simple curves at the edge centers, which consist of two points each, and move these curve points with Set Position to the endpoints of the edges.

    This step is crucial, because none of the other methods, e.g. with Split Edges or similar, gives the possibility to select the single points later comfortably. In addition, this way I avoid duplicate edges.

  3. By instantiating curves here, I then have the possibility to select the middle point as well as the inner points with Endpoint Selection. This is especially helpful, because the curve points should be moved individually for each spline/edge.

  4. But instead of dividing the curves with two intermediate points as in your example, I divide them three times here. This gives me a better selection possibility and I don't have to move the curve handles complicatedly in any directions, but I can reach the biggest part directly by moving the curve points.

    The points are moved here according to the following principle:

    • The position of the center point of each curve is randomly shifted a little, and then the closest face center point of the original mesh is used as the direction and scaled.
    • The intermediate points of the curve are shifted a little in the direction of the edge center. Just change the Seed value of the node Random Value to get different results.

    This way I get a good basic shape.

  5. In the last step these curves are converted into Bezier curves and the handles are smoothed.

    Finally, the handles of the center curve point are scaled out a little more, so that a teardrop-like shape is created.


I have no idea what you want to do with this thing, but I hope this suggested solution helps you a bit.

The funny thing about this setup is that you can actually apply it to any mesh, even a simple Ico Sphere for example:

enter image description here

Here is the blend file, have fun!


(Blender 3.2+)

$\endgroup$
6
  • 1
    $\begingroup$ @geomatico You are welcome! Thanks for the praise, glad it helps you! $\endgroup$
    – quellenform
    Commented Oct 29, 2022 at 17:54
  • 1
    $\begingroup$ There are problems on 3.2 (OK on 3.3). Very nice effect, I've been thinking about generating puzzles on 3D shapes, but probably there's an addon for that? Hard to find though, the search is littered with simpler 2D puzzles. Also for anything more complex than a mathematical figure, you want at least one polygon per puzzle… Also how would one print the 3D puzzles, since they require bends on male parts (tabs,knobs,loops,keys,outies, however you call them). So 3D printing, or maybe cutting from steel or something else you can bend… $\endgroup$ Commented Oct 30, 2022 at 14:21
  • 1
    $\begingroup$ @MarkusvonBroady Regarding the problem in version 3.2: Thanks for the tip, well observed! But this can be easily fixed by manually changing the curve type to Bezier in the node Set Spline Type. Obviously something has changed here in the node (change to ENUM in version 3.3: github.com/blender/blender/commit/…). And as for the other issue, I really have no idea what to do with it. :D $\endgroup$
    – quellenform
    Commented Oct 30, 2022 at 14:49
  • 1
    $\begingroup$ @quellenform makes me think… Shouldn't there be a "version" node? Maybe in some cases it would be useful to e.g. use one technique, but fall back to something simpler if the version is lower. Since Blender doesn't outright crash but just displays an unsupported node as red, that could allow to create more advanced setups for multiple versions without a Python manager… $\endgroup$ Commented Oct 30, 2022 at 16:45
  • 2
    $\begingroup$ @MarkusvonBroady Wow, this is a brilliant idea! Would actually be a feature request. This way you could create (to a certain degree) 100% backward compatible node trees. Nice! $\endgroup$
    – quellenform
    Commented Oct 30, 2022 at 16:47

You must log in to answer this question.

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