1
$\begingroup$

I would like to dynamically model meshes like image below : spheres for puzzle game Actually I would like to somehow create them via python script so that I can define them as an array

{
    id: 'orange',
    color : '#ef8710',
    size:[6,5],
    positions : [
        [
            [1,1,1,1],
            [1,0,1,0]
        ],
        [
            [1,1,1,1],
            [0,1,0,0]
        ]
    ]
},
{
    id: 'purple',
    color : '#d110ef',
    size:[5,4],
    positions : [
        [
            [1,1,1],
            [0,1,1]
            
        ],
        [
            [1,1,1],
            [0,0,1]   
        ]
    ]
}

On the other hand I think that in order to ease the blending part between spheres using geometry node would be a good deal.

Maybe it's absolutely unnecessary but the output would be 3d printed with resin

Any advice would be highly appreciated

$\endgroup$
1
  • 1
    $\begingroup$ have you tried using metaballs? $\endgroup$ May 26, 2022 at 9:13

1 Answer 1

3
$\begingroup$

I don't think that you have to use geometry nodes for that. It is easy to do with metaballs:

import bpy

coords = [(0,0,0),(0,0,1),(0,1,1),(0,0,2),(1,0,2)]

mball = bpy.data.metaballs.new("dot")
mball.resolution = 0.1
mball.threshold = 0.6
obj = bpy.data.objects.new("dot", mball)
bpy.context.collection.objects.link(obj)

for c in coords:
   
    ele = mball.elements.new()
    ele.radius =0.8
    
    ele.co = c

Script result:

enter image description here

threshold - 1.30, radius - 1

enter image description here

$\endgroup$
6
  • $\begingroup$ Great solution! Could this somehow be combined with Geometry Nodes? So that e.g. the array is created with Geometry Nodes, and that is processed by Python? $\endgroup$
    – quellenform
    May 26, 2022 at 10:00
  • $\begingroup$ No, GN doesn't work with meatballs at this point, and result with volumes not so soft. $\endgroup$
    – Crantisz
    May 26, 2022 at 10:03
  • $\begingroup$ Looks pretty amazing an simple ! Thanks $\endgroup$ May 26, 2022 at 10:18
  • 2
    $\begingroup$ Actually I found an example on how to use metaballs and Geometry Nodes youtube.com/watch?v=BGdYWBLzKOA $\endgroup$ May 26, 2022 at 10:45
  • $\begingroup$ On the other side, there's an issue I can not solve, is that in the image I posted above, the size + distance between the spheres would not produce enough influence for the metaballs to get sticked together, so I already tried changing the Influence threshold but then the global size of the metaball also get modified. Is there a way to get more influence without changing size ? $\endgroup$ May 26, 2022 at 10:48

You must log in to answer this question.

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